Not getting oauth_token_secret, where is it?


#1

So I’m trying to run account/verify_credentials and I’m getting “Could not authenticate you.” I’m also being rate limited to 150 instead of 300 and I think this is due to the same issue. I think I’ve narrowed this down to not getting the oauth_token_secret. When returning from https://api.twitter.com/oauth/authorize I’m getting the oauth_token and oauth_verifier. Where is oauth_token_secret?

I’ve been looking at this: https://dev.twitter.com/docs/auth/oauth#Making_a_resource_request_on_a_user-s_behalf
and I think I’m missing something…

I’ve been searching for a while and haven’t been able to find where oauth_token_secret is… any help is appreciated.

Thanks


#2

The oauth_token you receive from the callback after oauth/authorize is still a “request token.” You then use the oauth_verifier in a signed request to oauth/access_token (using the oauth_token_secret your received for the request token in oauth/request_token) to exchange the request token for an access token, for which you’ll once again get a new oauth_token and oauth_token_secret value, this time representing the access token.


#3

Interesting. Can you point me to the documentation for this?

I think I have it right though…

So I create a new OAuth Token with oauth access token and oauth request secret and send a new web request to oauth/access_token along with oauth verifier and I am returned a new oauth access token and oauth access secret?


#4

That indeed does work…

Strange… I didn’t see that documented anywhere.


#5

[node:115] (as well as the diagram within) goes over this – but honestly, there are so many steps involving parameters with the same names that mean different things in each context that it can get very easy to miss a crucial transformation or step in the process.

That the oauth_token returned in the callback is a reference to your existing oauth_token (request token context) could definitely be communicated better.


#6

Gotcha. Well I got it working! Access token & access secret were returned. That should bump up my rate limit to 300 as well. Thanks for your help!


#7

m not getting it
I have did it but still not getting authentication token as well as token secret :frowning:


#8

Hello, I am facing weird problem. I can get the request token having token secret and oauth token, but I do not have user id in request token. The request token I obtained was from oauth token and oauth token verifier I received after user authorizes the app. I know the user Id is contained in the AccessToken but however try I get the in valid credentials exception when trying to get the AccessToken
The code is below :
1st version which did not work

RequestToken reqToken = twitter.getOAuthRequestToken(oauthToken);
AccessToken accessToken = twitter.getOAuthAccessToken(reqToken,oauthVerifier);
//I beleive the pin used in the syntax above is the oauth verifier which we get after authorizing the app.

2nd version which pulled the token secret correctly, but did not get me the user id

RequestToken reqToken = twitter.getOAuthRequestToken(oauthToken,oauthVerifier);
//The token above in input is retrieved after authorization
//This gives me the token and token secret , but i wonder how do i get the user name of the user //accessing the application?
AccessToken accessToken = twitter.getOAuthAccessToken();//throws exception


#9

I figured it out. It works fine now.


#10

how do I get the hometimeline after getting the accesstoken? When I try to do the oauth verifier using getOAuthRequestToken -I get-status 200. But when I tried to get the hometimeline after this call or using the token and token secret shown in appsetting I get 401 unauthorized!!


#11

and why is my oauthtoken received from application setting different from request token


#12

now it is working but with get method only. Not with post method. When I try post method, i get the message this method supports only get method!!!


#13

Yes its working . Thanks.


#14

Can you show some code please I’m having the same problem.I keep geting oauth_verifier…but no oauth_token_secret.How did you solve it?didn’t understand the solution.$connection = new TwitterOAuth(‘CONSUMER_KEY’,‘CONSUMER_SECRET’, $_SESSION[‘oauth_token’],$_SESSION[‘oauth_token_secret’]); But i keep geting in the URL oauth_token and oauth_verifier.What do i do from there?


#15

How did you solve it?(code…please)


#16

how did you solve


#17

any one please give me the code for authentication of user using twitter step by step . I have tried using net.tutsplus.com and 9lessons.com.

I m using abrahms php outhand i m getting internal server error 500 exact call of function getRequestToken() of twitteroauth.php.


#18

Hi, I am having this problem.
Though I am passing a valid $oauth_verifier I am not getting oauth token and secret.

$token = $connection->getAccessToken($oauth_verifier);
print_r($token);

errors:
Undefined index: oauth_token in C:\xampp\xampp\htdocs\TwitterApp\twitteroauth\twitteroauth.php on line 114

Notice: Undefined index: oauth_token_secret in C:\xampp\xampp\htdocs\TwitterApp\twitteroauth\twitteroauth.php on line 114
Array ( [Invalid request token] => )

Can any body help it out???


#19

can anyone tell me which document i need to do this in!!!


#20

Never hope you will get proper guide from twitter. They actually don’t want us using their API.