I have a working Vue application which log user in via Google Javascript SDK. This get a token/code (I really dont how they call it). Then I send this token to the PHP application which uses Google api php client but then I really dont know what to do. Documentation does not show which class or method to use. I tried something like this:
$this->google_client = new Client();
$this->google_client->setClientId(config('services.google')['client_id']);
$this->google_client->setClientSecret(config('services.google')['client_secret']);
//$this->google_client->setAccessToken($token);
$this->google_client->addScope('openid');
$this->google_client->addScope('email');
//$this->google_client->addScope('profile');
$access_token = $this->google_client->fetchAccessTokenWithAuthCode($token);
Log::info($access_token);
$this->google_client->setAccessToken($access_token);
But the Log store this:
[
'error' => 'invalid_grant',
'error_description' => 'Bad Request',
]
5