0

I'm using scribe for logging into LinkedIn in my application.

I would like to know if there is a way to automate the process of getting accessToken so that the user doesn't have to enter the Verifier token.

Possible? If yes, may i get a little help with the same?

Thanks in advance :)

Krish
  • 917
  • 4
  • 10
  • 23

2 Answers2

2

You can add the callback to the ServiceBuilder in the current version of Scribe like this:

    OAuthService service = new ServiceBuilder()
                        .provider(LinkedInApi.class)
                        .apiKey(SystemVariables.LINKEDINAPIKEY)
                        .apiSecret(SystemVariables.LINKEDINSECRETKEY)
                        .callback("YOUR_CALLBACK_URL_HERE")
                        .build();
NickChase
  • 1,442
  • 3
  • 15
  • 23
  • I have tried that, but it throws an exception. I am following the same paradigm for a provided [non-OOB sample](https://github.com/fernandezpablo85/scribe-java/blob/cafa2fd69f70bfbf81324c83528b196ca7c14998/src/test/java/org/scribe/examples/LiveExample.java): ` OAuthService service = new ServiceBuilder() .provider(LinkedInApi.class) .apiKey(key) .apiSecret(secret) .callback(callback) .build(); String url = service.getAuthorizationUrl(EMPTY_TOKEN);` – Michael M Dec 02 '13 at 21:58
  • Doing it this way: `service.getAuthorizationUrl(service.getRequestToken())` does not work either because the URL provided does not contain the call back URL. – Michael M Dec 02 '13 at 22:03
1

You can get the browser redirected to a url of your choice, if you provide it via the callback method of the ServiceBuilder.

Pablo Fernandez
  • 103,170
  • 56
  • 192
  • 232
  • Thanks for the reply. But in the new version of scribe, where do i mention the usage of callback feature? By default, it gives me a link that I'll have to visit manually (OOB it is). – Krish Apr 23 '12 at 17:25