@ Override public Token getAccessToken ( Token requestToken , Verifier verifier ) { OAuthRequest request = new ProxyOAuthRequest ( this . api . getAccessTokenVerb ( ) , this . api . getAccessTokenEndpoint ( ) , this . proxyHost , this . proxyPort ) ; String userpass = this . config . getApiKey ( ) + ":" + this . config . getApiSecret ( ) ; String basicAuth = "Basic " + javax . xml . bind . DatatypeConverter . printBase64Binary ( userpass . getBytes ( ) ) ; request . addHeader ( "Authorization" , basicAuth ) ; request . addBodyParameter ( "grant_type" , "authorization_code" ) ; request . addBodyParameter ( "code" , verifier . getValue ( ) ) ; request . addBodyParameter ( "redirect_uri" , config . getCallback ( ) ) ; Response response = request . send ( ) ; String body = response . getBody ( ) ; JsonNode json = JsonHelper . getFirstNode ( body ) ; if ( json != null ) { return new Token ( ( String ) JsonHelper . get ( json , "access_token" ) , "" , body ) ; } else { return null ; } }
Makes the call to request an access token for an authorized user .