Archive for the ‘oauth’ Category

Get callback working in Scribe and OAuth

Wednesday, August 3rd, 2011

I was developing LinkedIn API and had some trouble getting callback working after getting user authentication from LinkedIn. I even had configured “OAuth Redirect URL:” in application settings, adding oauth_callback to redirect when asking user authorization did not help either. I kept getting OOB eg out-of-band style authentication where user must manually type in the security code. Examples in scribe website did not help to fix the problem.

In JSF bean i used following code

OAuthService service=new ServiceBuilder().provider(LinkedInApi.class).apiKey("apikey").apiSecret("apisecret").build();
Token requestToken = service.getRequestToken();
String authUrl=service.getAuthorizationUrl(requestToken);

Problem was fixed by adding .callback to ServiceBuilder when building service.

OAuthService service=new ServiceBuilder().provider(LinkedInApi.class).apiKey("apikey").apiSecret("apisecret").callback("http://localhost:8084/WebApplication1/authenticated.jsf").build();