我正在尝试在laravel应用程序上使用GuzzleHttp生成Google OAuth 2令牌,但出现此错误消息-
Client error: `POST https://accounts.google.com/o/oauth2/token` resulted in a `400 Bad Request` response: { "error": "invalid_grant", "error_description": "Bad Request" }
这是我的代码
$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);
请问这里可能是什么问题?