简体   繁体   中英

Twitter oAuth - Request tokens

I'm using http://wordpress.org/extend/plugins/simple-twitter-connect/ to use twitter on a wordpress blog. But I've a problem with request tokens.

Here's my code:

$to = new TwitterOAuth($options['consumer_key'], $options['consumer_secret']);
$tok = $to->getRequestToken();


function getRequestToken() {
    $r = $this->oAuthRequest($this->requestTokenURL());
    $token = $this->oAuthParseResponse($r);
    $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
    return $token;
}

But after clicking on the sign in button, Twitter returns this:

'Whoa there! There is no request token for this page. That's the special key we need from applications asking to use your Twitter account.'

The URL is https://twitter.com/oauth/authenticate?oauth_token=

Presumably the missing value is the problem.

I'm hoping to then allow the logged in user to tweet from the site, yet I haven't even gone near that with the above problem.

Any ideas??

Haves you tried logging into Twitters Developer site ( https://dev.twitter.com/ ) to get your access token? If not you need to create an app which will allow access from your site to twiiter. The Directions on the developer site are pretty easy to follow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM