阅读(754)
赞(10)
Laravel 8 获取令牌
2021-07-09 12:59:41 更新
要获取此授权类型的令牌,请向 oauth/token
发出请求:
$guzzle = new GuzzleHttpClient;
$response = $guzzle->post('http://your-app.com/oauth/token', [
'form_params' => [
'grant_type' => 'client_credentials',
'client_id' => 'client-id',
'client_secret' => 'client-secret',
'scope' => 'your-scope',
],
]);
return json_decode((string) $response->getBody(), true)['access_token'];