Support scope param in client credentials grant.
This commit is contained in:
parent
33dd519029
commit
a74b1a2fab
1 changed files with 10 additions and 0 deletions
|
@ -45,6 +45,12 @@ final class ClientCredsRoutes extends RouteHandler {
|
|||
<input type=password name=client_secret required>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label>
|
||||
<span>Scope:</span>
|
||||
<input type=text name=scope>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<span>Authentication:</span>
|
||||
<label>
|
||||
|
@ -95,6 +101,7 @@ HTML;
|
|||
$clientId = (string)$content->getParam('client_id');
|
||||
$clientSecret = (string)$content->getParam('client_secret');
|
||||
$auth = (string)$content->getParam('auth');
|
||||
$scope = (string)$content->getParam('scope');
|
||||
|
||||
$headers = [];
|
||||
$body = ['grant_type' => 'client_credentials'];
|
||||
|
@ -105,6 +112,9 @@ HTML;
|
|||
} else
|
||||
$headers[] = sprintf('Authorization: Basic %s', base64_encode(sprintf('%s:%s', $clientId, $clientSecret)));
|
||||
|
||||
if($scope !== '')
|
||||
$body['scope'] = $scope;
|
||||
|
||||
$body = Tools::shuffleArray($body);
|
||||
$response = Tools::fetch($tokenUri, headers: $headers, body: $body);
|
||||
|
||||
|
|
Loading…
Reference in a new issue