You are here

public function ClientCredentialsTest::testOauthToken in Auth0 Single Sign On 8.2

File

vendor/auth0/auth0-php/tests/API/Authentication/ClientCredentialsTest.php, line 10

Class

ClientCredentialsTest

Namespace

Auth0\Tests\API\Authentication

Code

public function testOauthToken() {
  $env = self::getEnv();
  $api = new Authentication($env['DOMAIN'], $env['APP_CLIENT_ID'], $env['APP_CLIENT_SECRET']);
  $token = $api
    ->client_credentials([
    'audience' => 'https://' . $env['DOMAIN'] . '/api/v2/',
  ]);
  $this
    ->assertArrayHasKey('access_token', $token);
  $this
    ->assertArrayHasKey('token_type', $token);
  $this
    ->assertEquals('bearer', strtolower($token['token_type']));
}