public function Authentication::client_credentials in Auth0 Single Sign On 8.2
Makes a call to the `oauth/token` endpoint with `client_credentials` grant type.
TODO: MAJOR - Add a new ApiException for missing audience.
@link https://auth0.com/docs/api-auth/grant/client-credentials
Parameters
array $options Information required for this grant.:
- options.client_id Application Client ID.
- options.client_secret Application Client Secret.
- options.audience API Audience requested.
Return value
mixed
Throws
ApiException If client_id or client_secret are missing.
File
- vendor/
auth0/ auth0-php/ src/ API/ Authentication.php, line 485
Class
- Authentication
- Class Authentication
Namespace
Auth0\SDK\APICode
public function client_credentials(array $options) {
if (!isset($options['client_secret'])) {
$options['client_secret'] = $this->client_secret;
}
if (empty($options['client_secret'])) {
throw new ApiException('client_secret is mandatory');
}
if (!isset($options['client_id'])) {
$options['client_id'] = $this->client_id;
}
if (empty($options['client_id'])) {
throw new ApiException('client_id is mandatory');
}
if (!isset($options['audience'])) {
$options['audience'] = $this->audience;
}
$options['grant_type'] = 'client_credentials';
return $this
->oauth_token($options);
}