Google API overwrites OAuth2 state parameter on callback

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

Auth0 getState() method

Link to the error stack image:

What is the best approach here and what shoud I do?

Hey there!

Sorry for such huge delay in response! We’re doing our best in providing you with best developer support experience out there, but sometimes our bandwidth is not enough comparing to the number of incoming questions.

Wanted to reach out to know if you still require further assistance?