Last active
August 29, 2015 13:56
-
-
Save tlayh/9303920 to your computer and use it in GitHub Desktop.
Get the login URL to sign in with twitter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* get the login url from oauth | |
* | |
* @return string $loginUrl | |
*/ | |
public function getLoginUrl() { | |
// create the twitterOAuth object using your consumer_key and consumer_secret, after creating an app on | |
// dev.twitter.com/apps | |
$this->twitterOAuth = new TwitterOAuth($this->consumerKey, $this->consumerSecret); | |
// get a request token from twitter | |
$requestToken = $this->twitterOAuth->getRequestToken($this->callback); | |
$this->oauthToken = $requestToken['oauth_token']; | |
$this->oauthTokenSecret = $requestToken['oauth_token_secret']; | |
// get the url to make it possible to login. | |
$loginUrl = $this->twitterOAuth->getAuthorizeUrl($this->oauthToken); | |
return $loginUrl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment