Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Scribe library for Oauth in Twitter with callback url

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!!!

like image 262
Ashish Mittal Avatar asked Jun 13 '12 14:06

Ashish Mittal


People also ask

How do I add a callback URL to Twitter?

Enable 3rd Party Application in TwitterClick "App Settings". Scroll down to your app and click the settings (cog) icon. Scroll down to "Authentication settings" and click "Edit". Toggle "Enable 3-legged OAuth" to be on, and we'll need to fill in two properties, Callback URLs and Website URL .

What is the use of callback URL in OAuth?

The callback URL typically specifies the URL of an app that is designated to receive an authorization code on behalf of the client app. In addition, this URL string is used for validation.

What is callback URI redirect URL Twitter?

As users work through these flows, they need a web page or location to be sent to after they have successfully logged in and provided authorization to the developer's App. This follow-up webpage or location is called a callback URL.


2 Answers

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.

like image 104
Ashish Mittal Avatar answered Oct 23 '22 10:10

Ashish Mittal


See the Twitter example.

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

like image 30
stevebot Avatar answered Oct 23 '22 09:10

stevebot