/** * After a Request Token is retrieved, the user may be redirected to the * OAuth Provider to authorise the application's access to their * protected resources - the redirect URL being provided by this method. * Once the user has authorised the application for access, they are * redirected back to the application which can now exchange the previous * Request Token for a fully authorised Access Token. * * @param array $customServiceParameters * @param Zend_Oauth_Token_Request $token * @param Zend_OAuth_Http_UserAuthorisation $redirect * @return string */ public function getRedirectUrl(array $customServiceParameters = null, Zend_Oauth_Token_Request $token = null, Zend_Oauth_Http_UserAuthorisation $redirect = null) { if (is_null($redirect)) { $redirect = new Zend_Oauth_Http_UserAuthorisation($this, $customServiceParameters); } elseif (!is_null($customServiceParameters)) { $redirect->setParameters($customServiceParameters); } if (!is_null($token)) { $this->_requestToken = $token; } return $redirect->getUrl(); }
public function testGetUrlReturnsEncodedQueryStringParamsAppendedToLocalUrl() { $redirect = new Zend_Oauth_Http_UserAuthorisation($this->stubConsumer, array('foo ' => 'bar~')); $expected = 'http://www.example.com/authorise?oauth_token=1234567890&oauth_callback=http%3A%2F%2Fwww.example.com%2Flocal&foo%20=bar~'; $this->assertEquals($expected, $redirect->getUrl()); }