public function OAuth2ClientTest::clientCredentialsFlow in OAuth2 Client 8
Test the client-credentials flow.
1 call to OAuth2ClientTest::clientCredentialsFlow()
- OAuth2ClientTest::testGetAccessToken in tests/
src/ Functional/ OAuth2ClientTest.php
File
- tests/
src/ Functional/ OAuth2ClientTest.php, line 60
Class
- OAuth2ClientTest
- Test OAuth2 Client.
Namespace
Drupal\Tests\oauth2_client\FunctionalCode
public function clientCredentialsFlow() {
$token1 = $this
->getToken('client-credentials');
$token2 = $this
->getToken('client-credentials');
$this
->assertEquals($token2, $token1, 'The same cached token is used, while it has not expired yet.');
// Wait for the token to expire.
sleep(10);
$token3 = $this
->getToken('client-credentials');
$this
->assertNotEquals($token3, $token1, 'Getting a new token, client-credential flow has no refresh token.');
}