I am trying to generate Google OAuth 2 token using GuzzleHttp on a laravel application but I am getting this error message -
Client error: `POST https://accounts.google.com/o/oauth2/token` resulted in a `400 Bad Request` response: { "error": "invalid_grant", "error_description": "Bad Request" }
Here is my code
$client = new Client();
$call = $client->post(env('AUTH_URL'), [
'form_params' => [
'client_id' => env('CLIENT_ID'),
'client_secret' => env('CLIENT_SECRET'),
'redirect_uri' => env('CALLBACK_URL'),
'grant_type' => 'authorization_code',
'scope' => env('SCOPE'),
'code' => env('AUTH_CODE')
]
]);
$response = json_decode($call->getBody()->getContents(), true);
dd($response);
Please what might be the problem here?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire