I’m using laravel-socialite
to attach google account to an already existing user in my database by fetching a token from Google. Everything works fine until I get to the handleProviderGoogleCallback()
.
$authUser = Socialite::driver('google')->stateless()->user();
Administrator::find(Auth::user()->getUserInfo()->id)->update(['refresh_token' => $authUser->token]);
This is the callback URL with the state parameter that overwrites the 0Auth2 state
parameter, used to verify the currently logged user.
login/google/callback?state=V8ZOw0Wh1qnAEuEyZqWtHa7hIvvHEBGf9sS7BgPSOqf&code=code&hd=user&session_state=913e911a451d4a23f511b626c812bf6066480534e4f..6cfa&prompt=none
Link to the error stack image:
What is the best approach here and what shoud I do?