final String accessTokenURL = c.getString(SettingKeys.ACCESS_TOKEN_URL);
final String authorizationURL = c
.getString(SettingKeys.AUTHORIZATION_URL);
final ServiceInfo info = new ServiceInfo(requestTokenURL,
accessTokenURL, authorizationURL, key);
final OAuth service = new OAuth(info, true);
checkError(request);
if (uri.contains(Constants.OAUTH_VERIFIER)) {
final RequestToken rtoken = (RequestToken) PlayAuthenticate
.removeFromCache(context.session(), CACHE_TOKEN);
final String verifier = request.getQueryString(Constants.OAUTH_VERIFIER);
try {
final RequestToken response = service
.retrieveAccessToken(rtoken, verifier);
final I i = buildInfo(response);
return transform(i);
} catch (RuntimeException ex) {
throw new AuthException(ex
.getLocalizedMessage());
}
} else {
final String callbackURL = getRedirectUrl(request);
try {
final RequestToken response = service
.retrieveRequestToken(callbackURL);
// All good, we have the request token
final String token = response.token;
final String redirectUrl = service.redirectUrl(token);
PlayAuthenticate.storeInCache(context.session(), CACHE_TOKEN,
new SerializableRequestToken(response));
return redirectUrl;
} catch (RuntimeException ex) {