com.google.api.client.auth.oauth.OAuthGetAccessToken

Here are the examples of the java api class com.google.api.client.auth.oauth.OAuthGetAccessToken taken from open source projects.

1. AuthorizationFlow#new10aTokenRequest()

View license
/**
     * Returns a new instance of a token request based on the given verifier
     * code. This step is defined in <a
     * href="http://oauth.net/core/1.0a/#auth_step3">Obtaining an Access
     * Token</a>.
     * 
     * @param temporaryCredentials
     * @param verifierCode
     * @return
     */
public OAuthGetAccessToken new10aTokenRequest(OAuthCredentialsResponse temporaryCredentials, String verifierCode) {
    OAuthGetAccessToken request = new OAuthGetAccessToken(getTokenServerEncodedUrl());
    request.temporaryToken = temporaryCredentials.token;
    request.transport = getTransport();
    OAuthHmacSigner signer = new OAuthHmacSigner();
    ClientParametersAuthentication clientAuthentication = (ClientParametersAuthentication) getClientAuthentication();
    signer.clientSharedSecret = clientAuthentication.getClientSecret();
    signer.tokenSharedSecret = temporaryCredentials.tokenSecret;
    request.signer = signer;
    request.consumerKey = clientAuthentication.getClientId();
    request.verifier = verifierCode;
    return request;
}

2. OAuthHmacThreeLeggedFlow#complete()

View license
public Credential complete(String authorizationCode) throws IOException {
    Preconditions.checkNotNull(transport, "Must call setHttpTransport before calling complete.");
    OAuthGetAccessToken accessToken = new OAuthGetAccessToken(authorizationServerUrl);
    accessToken.temporaryToken = tempToken;
    accessToken.transport = transport;
    OAuthHmacSigner signer = new OAuthHmacSigner();
    signer.clientSharedSecret = consumerSecret;
    signer.tokenSharedSecret = tempTokenSecret;
    accessToken.signer = signer;
    accessToken.consumerKey = consumerKey;
    accessToken.verifier = authorizationCode;
    OAuthCredentialsResponse credentials = accessToken.execute();
    signer.tokenSharedSecret = credentials.tokenSecret;
    OAuthHmacCredential accessCredential = new OAuthHmacCredential(userId, consumerKey, consumerSecret, credentials.tokenSecret, credentials.token);
    return accessCredential;
}