use of com.github.scribejava.core.builder.api.DefaultApi20 in project scribejava by scribejava.
the class ImgurOAuthServiceImpl method createAccessTokenRequest.
@Override
protected OAuthRequest createAccessTokenRequest(String oauthVerifier) {
final DefaultApi20 api = getApi();
final OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint());
final OAuthConfig config = getConfig();
request.addBodyParameter(OAuthConstants.CLIENT_ID, config.getApiKey());
request.addBodyParameter(OAuthConstants.CLIENT_SECRET, config.getApiSecret());
if (ImgurApi.isOob(config)) {
request.addBodyParameter(OAuthConstants.GRANT_TYPE, "pin");
request.addBodyParameter("pin", oauthVerifier);
} else {
request.addBodyParameter(OAuthConstants.GRANT_TYPE, OAuthConstants.AUTHORIZATION_CODE);
request.addBodyParameter(OAuthConstants.CODE, oauthVerifier);
}
return request;
}
Aggregations