I am trying to log in with Google+ API in my website using Socialite package. but it is not working as expected. I am developing a website in Laravel. The API is working fine returning all data using JS but when I am trying to do this using Socialite, It showing 403 Forbidden Error page when redirecting back.
My Route:
Route::get('auth/{provider}', 'Auth\AuthController@redirectToProvider');
Route::get('auth/{provider}/callback', 'Auth\AuthController@handleProviderCallback');
Redirect Method:
public function redirectToProvider($provider)
{
return Socialite::driver($provider)->stateless()->redirect();
}
Callback Method:
public function handleProviderCallbackd($provider)
{
$user = Socialite::driver($provider)->stateless()->user();
$authUser = $this->findOrCreateUser($user, $provider);
Auth::login($authUser, true);
return redirect($this->redirectTo);
}
I have tried to use stateless() method to avoid the error but it is not working.
Note: When it redirect back the URL has scope parameter, if I remove that parameter then it works fine.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2SyCJFW
via IFTTT
Aucun commentaire:
Enregistrer un commentaire