5

I am implementing twitter in my application using scribe. After the user authenticate my app and is redirected to new url, I got the oauth_token and oauth_verifier but could not figure out how to generate oauth_token and oauth_secret from it. Kindly resolve the issue and thank you in advance!!!

Ashish Mittal
  • 141
  • 1
  • 2
  • 9

2 Answers2

6

I've solved the problem just make a new service builder(as in the example) in the redirected page and use the oauth_token and oauth_verifier u'll get when u will be redirected to new page like this

Token requestToken = new Token(request.getParameter("oauth_token"),request.getParameter("oauth_verifier"));
Verifier verifier = new Verifier(request.getParameter("oauth_verifier"));

rest is same as in example.

Ashish Mittal
  • 141
  • 1
  • 2
  • 9
  • mhh i had the same problem, i tried saving the old request Token and creating it the way you suggested, i even get an access token, but every time i try fetching data through the api i get an error message. – webstrap Aug 24 '12 at 15:48
  • There is no need to save the old request in case of Twitter(but might be useful in case of LinkedInn).Just use the oauth_token and oauth_verifier you got in the response to create a new requestToken. – Ashish Mittal Aug 25 '12 at 18:48
2

See the Twitter example.

The oauth token and verifier should be what you need to request an access token and access protected resources.

stevebot
  • 23,275
  • 29
  • 119
  • 181
  • 1
    I have read the example but the example illustrates a PIN based authentication whereas i dont want such in my application. I am stuck at the point where in example the verifier is used coz i dont have any in case of callback_url. Kindly help me with another approach. – Ashish Mittal Jun 14 '12 at 05:55
  • 1
    what do you mean by PIN based authentication? Do you mean that you do not want the user to have to paste the verifier? I guess a good question is which of the options listed in https://dev.twitter.com/docs/auth/obtaining-access-tokens do you want to use? – stevebot Jun 14 '12 at 17:29
  • 1
    Actually i dont want user to the Verifier PIN and want to redirect it to a new page thats it. – Ashish Mittal Jun 15 '12 at 05:51