public function testGetAuthorizationRequestUriForCodeResponseType() { $config = $this->getConfig(); $oauth2Client = new OAuth2Client($config); $authorizationRequest = new AuthorizationRequest(); $authorizationRequest->setScope(new Scope(array('scope-token-1', 'scope-token-2'))); $grant = new AuthorizationCodeGrant(null, $authorizationRequest); $uri = $oauth2Client->buildAuthorizationRequestUri($grant); $this->assertSame('https://auth.example.com/authorize?response_type=code&client_id=s6BhdRkqt3&scope=scope-token-1+scope-token-2', $uri); }
public function testGetAccessTokenRefreshTokenGrant() { $config = $this->getConfig(); $oauth2Client = new OAuth2Client($config); $accessTokenExpectedResponse = new AccessTokenSuccessfulResponse(new AccessToken('2YotnFZFEjr1zCsicMWpAA'), TokenType::BEARER()); $accessTokenExpectedResponse->setExpiresIn(new ExpiresIn(3600)); $accessTokenExpectedResponse->setRefreshToken(new RefreshToken('dD3BGS4cfASc3CFS23caxcs')); $accessTokenRequest = new AccessTokenRequest(new RefreshToken('tGzv3JOkF0XG5Qx2TlKWIA')); $grant = new RefreshTokenGrant($accessTokenRequest); $accessTokenResponse = $oauth2Client->obtainAccessToken($grant); $this->assertEquals($accessTokenExpectedResponse, $accessTokenResponse); }