Example usage for com.google.api.client.googleapis.auth.oauth2 GoogleAuthorizationCodeRequestUrl setAccessType

List of usage examples for com.google.api.client.googleapis.auth.oauth2 GoogleAuthorizationCodeRequestUrl setAccessType

Introduction

In this page you can find the example usage for com.google.api.client.googleapis.auth.oauth2 GoogleAuthorizationCodeRequestUrl setAccessType.

Prototype

public GoogleAuthorizationCodeRequestUrl setAccessType(String accessType) 

Source Link

Document

Sets the access type ( "online" to request online access or "offline" to request offline access) or null for the default behavior of "online" .

Usage

From source file:utils.gce.auth.GoogleComputeEngineAuthImpl.java

License:Apache License

public String getRefreshTokenURL(final String redirectUri) throws GoogleComputeEngineException {
    GoogleAuthorizationCodeRequestUrl url = authorizationCodeFlow.newAuthorizationUrl();
    //GoogleAuthorizationCodeRequestUrl url = new GoogleAuthorizationCodeRequestUrl(clientId, redirectUri, SCOPES).setAccessType("offline");
    url.setRedirectUri(redirectUri);/* w  w  w.  j  av  a 2s.  c om*/
    url.setApprovalPrompt("force");
    url.setAccessType("offline");
    url.setClientId(clientId);
    url.setScopes(SCOPES);
    return url.build();
}