I am trying to use oauth for google in laravel 5 but i am getting the error. Can any one help me to sort out this problem.
//Followings are my files please check out
.env
GOOGLE_ID = 'mygoogleId'
GOOGLE_SECRET = 'mysecretID'
GOOGLE_REDIRECT = http://localhost:8090/users
services.php
'google' => [
'client_id' => env('GOOGLE_ID'),
'client_secret' => env('GOOGLE_SECRET'),
'redirect' => env('GOOGLE_REDIRECT'),
],
AuthController
public function redirectToProvider() {
return Socialite::driver('google')->redirect();
}
public function handleProviderCallback() {
$user = Socialite::driver('google')->user();
console.log($user);
}
routes.php
Route::get('google', 'Auth\AuthController@redirectToProvider');
Route::get('google/callback', 'Auth\AuthController@handleProviderCallback');
//I have set the providers and aliases in app.php.
Thanks in advance..
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire