/** Request a token from twitter and authorise the app */ public function generate() { $config = array('requestTokenUrl' => 'http://www.flickr.com/services/oauth/request_token', 'accessTokenUrl' => 'http://www.flickr.com/services/oauth/access_token', 'userAuthorisationUrl' => 'http://www.flickr.com/services/oauth/authorize', 'localUrl' => 'http://beta.finds.org.uk/admin/oauth', 'callbackUrl' => self::CALLBACKURL, 'consumerKey' => $this->_consumerKey, 'consumerSecret' => $this->_consumerSecret, 'version' => '1.0', 'signatureMethod' => 'HMAC-SHA1'); $consumer = new Zend_Oauth_Consumer($config); $consumer->setAuthorizeUrl('http://www.flickr.com/services/oauth/authorize'); $token = $consumer->getRequestToken(); $session = new Zend_Session_Namespace('flickr_oauth'); $session->token = $token->getToken(); $session->secret = $token->getTokenSecret(); $consumer->redirect($customServiceParameters = array('perms' => 'delete')); }
/** Request a token from twitter and authorise the app */ public function generate() { $config = array('requestTokenUrl' => 'https://www.google.com/accounts/OAuthGetRequestToken', 'accessTokenUrl' => 'https://www.google.com/accounts/OAuthGetAccessToken', 'userAuthorisationUrl' => 'https://www.google.com/accounts/OAuthAuthorizeToken', 'localUrl' => Zend_Registry::get('siteurl') . '/admin/oauth', 'callbackUrl' => $this->getCallback(), 'consumerKey' => $this->getConsumerKey(), 'consumerSecret' => $this->getConsumerSecret(), 'version' => '1.0', 'signatureMethod' => 'HMAC-SHA1'); $consumer = new Zend_Oauth_Consumer($config); $consumer->setAuthorizeUrl('https://www.google.com/accounts/OAuthAuthorizeToken'); $token = $consumer->getRequestToken(); $session = new Zend_Session_Namespace('google_oauth'); $session->token = $token->getToken(); $session->secret = $token->getTokenSecret(); $consumer->redirect(); }