Pergunta

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?

Foi útil?

Solução

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.

Outras dicas

Use HTTP Client for POST request to authorization URL.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top