Login problems with google

0

I'm using Laravel Socialite to sign in to google accounts. It's working perfectly. But if I log into an account and use the browser back button to choose another account to login, the following error is displayed:

Laravel \ Socialite \ Two \ InvalidStateException No message

Itriedtodisablethebrowserbackbuttons,butIdidnotsucceed.

Myfunctionslooklikethis:

publicfunctionredirectToProvider(){returnSocialite::driver('google')->redirect();}publicfunctionhandleProviderCallback(){$user=Socialite::driver('google')->user();$dados=['name'=>$user->getName(),'email'=>$user->getEmail(),'remember_token'=>$user->token,'login_google'=>1];$checkUser=User::where('email','=',$user->getEmail())->get();if($checkUser->isEmpty()){$userCreate=newUser($dados);if($userCreate->save()){Auth::loginUsingId($userCreate->id);if(session()->get('url')=="0") {
                return redirect('/');
            }
            else {
                return redirect(session()->get('url'));
            }
        }
    }
    else {
        $checkUser = $checkUser->toArray();
        Auth::loginUsingId($checkUser[0]['id']);

        if(session()->get('url') == "0") {
            return redirect('/');
        }
        else {
            return redirect(session()->get('url'));
        }
    }
}
    
asked by anonymous 11.09.2018 / 14:45

0 answers