public function ClientGrants::create in Auth0 Single Sign On 8.2
Create a new Client Grant. Required scope: "create:client_grants"
@link https://auth0.com/docs/api/management/v2#!/Client_Grants/post_client_grants
Parameters
string $client_id Client ID to receive the grant.:
string $audience Audience identifier for the API being granted.:
array $scope Array of scopes for the grant.:
Return value
mixed
Throws
CoreException Thrown when $client_id or $audience are empty or not a string.
\Exception Thrown by the HTTP client when there is a problem with the API call.
File
- vendor/
auth0/ auth0-php/ src/ API/ Management/ ClientGrants.php, line 112
Class
- ClientGrants
- Class ClientGrants. Handles requests to the Client Grants endpoint of the v2 Management API.
Namespace
Auth0\SDK\API\ManagementCode
public function create($client_id, $audience, array $scope = []) {
if (empty($client_id) || !is_string($client_id)) {
throw new CoreException('Empty or invalid "client_id" parameter.');
}
if (empty($audience) || !is_string($audience)) {
throw new CoreException('Empty or invalid "audience" parameter.');
}
return $this->apiClient
->method('post')
->addPath('client-grants')
->withBody(json_encode([
'client_id' => $client_id,
'audience' => $audience,
'scope' => $scope,
]))
->call();
}