Ashraf Hefny
Ashraf Hefny

Reputation: 538

laravel socialite get google access token from google Authorization Code

I've an Android app that use google authentication to register users
and I am using laravel socillite for the authentication

I can't get this to work because the android app send me an authorization code not the access token and I do't know how can I get the access token from that Authorization Code
From my understanding I should do the following:

Upvotes: 1

Views: 4198

Answers (1)

Ashraf Hefny
Ashraf Hefny

Reputation: 538

I did solve this by using a getAccessTokenResponse function as the followoing:

$access_token = Socialite::driver($provider)->getAccessTokenResponse($token);
$user = Socialite::driver($provider)->userFromToken($access_token['access_token']);

Upvotes: 5

Related Questions