mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-05-31 14:12:07 +05:30
Renamed auth to authServer
This commit is contained in:
24
tests/authServer/AuthCodeCept.php
Normal file
24
tests/authServer/AuthCodeCept.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
$I = new AuthTester($scenario);
|
||||
$I->wantTo('get an access token with an authorization code');
|
||||
$I->sendGET('authcode_grant.php/authorize?client_id=testclient&redirect_uri=http%3A%2F%2Fexample.com%2Fredirect&response_type=code&scope=basic');
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeHttpHeader('Location');
|
||||
|
||||
$location = $I->grabHttpHeader('Location');
|
||||
$urlParts = parse_url($location);
|
||||
parse_str($urlParts['query'], $queryString);
|
||||
|
||||
$I->sendPOST('authcode_grant.php/access_token', [
|
||||
'client_id' => 'testclient',
|
||||
'redirect_uri' => 'http://example.com/redirect',
|
||||
'client_secret' => 'secret',
|
||||
'code' => $queryString['code'],
|
||||
'grant_type' => 'authorization_code'
|
||||
]);
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeJsonKeyExists('expires_in');
|
||||
$I->seeJsonKeyExists('access_token');
|
||||
$I->seeResponseContainsJson(['token_type' => 'Bearer']);
|
||||
$I->seeJsonKeyDoesNotExists('foobar');
|
||||
Reference in New Issue
Block a user