/** * Authorize application * * First part of OAuth 1.0 authentication is retrieving temporary * credentials. These identify you as a client to the server. Store the * credentials in the session. Return authorization url. * * @param TemporaryCredentials $temporaryCredentials * * @return string Authorization url */ public function getAuthorizationUrl(TemporaryCredentials $temporaryCredentials = null) { if (is_null($temporaryCredentials)) { $sessionKey = self::getCredentialSessionKey(); $temporaryCredentials = $this->getTemporaryCredentials(); $_SESSION[$sessionKey] = serialize($temporaryCredentials); session_write_close(); } return $this->client->getAuthorizationUrl($temporaryCredentials); }
public function testGettingAuthorizationUrlWithScopeAfterSettingScope() { $scope = $this->getApplicationScope(false); $server = new Trello($this->getMockClientCredentials()); $server->setApplicationScope($scope); $expected = 'https://trello.com/1/OAuthAuthorizeToken?response_type=fragment&scope=' . urlencode($scope) . '&expiration=1day&oauth_token=foo'; $this->assertEquals($expected, $server->getAuthorizationUrl('foo')); $credentials = m::mock('League\\OAuth1\\Client\\Credentials\\TemporaryCredentials'); $credentials->shouldReceive('getIdentifier')->andReturn('foo'); $this->assertEquals($expected, $server->getAuthorizationUrl($credentials)); }