4
votes

I am trying to get the access token for LinkedIn Here's the part of code,

OAuthService service = new ServiceBuilder().provider(LinkedInApi.class).apiKey("My_Api_Key").apiSecret("My_secret_key").build();

System.out.println("LinkedIn Service created");         
Token token = service.getRequestToken();

System.out.println("Got Request token");            
System.out.println(service.getAuthorizationUrl(token));
//https://api.linkedin.com/uas/oauth/authorize?oauth_token=some_value
Verifier verifier = new Verifier("verifier_you_got_previously");

I am able to obtain a request token, and the authorization url which is https://api.linkedin.com/uas/oauth/authorize?oauth_token=some_value To get the Verifier object, I need to pass the verifier value to the constructor. How do I obtain this value? This is a oob request, so there's no callback set to the service. What should I do with the authorization Url to get the oauth_verifier?

2
use the inline login if u just want to login.Sashi Kant
you are using scribe, for this just read this post by the author of scribe developer.linkedin.com/thread/1745Umesh Awasthi
U check the Javascript API tutorial in developers.linkedin.com The inline login is the easiest of them all. It gets called in the onload function of the body.. If u still have a doubt I will share u the code...Sashi Kant
@UmeshAwasthi that post is really dated. Sorry, I never updated it :(Pablo Fernandez
@PabloFernandez: thats good even myself is using scribe for almost all of my application great work :)Umesh Awasthi

2 Answers

5
votes

Your server doesn't get the verifier. You need to redirect your user to the authorizationUrl, then ask them to provide it to you somehow.

This is how OAuth works, you can't trick the system.

0
votes

Use HTTP Client for POST request to authorization URL.