Class AuthorizationCodeRequestUrl

java.lang.Object
java.util.AbstractMap<String,Object>
com.google.api.client.util.GenericData
com.google.api.client.http.GenericUrl
com.google.api.client.auth.oauth2.AuthorizationRequestUrl
com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl
All Implemented Interfaces:
Cloneable, Map<String,Object>

public class AuthorizationCodeRequestUrl extends AuthorizationRequestUrl
OAuth 2.0 URL builder for an authorization web page to allow the end user to authorize the application to access their protected resources and that returns an authorization code, as specified in Authorization Code Grant.

The default for AuthorizationRequestUrl.getResponseTypes() is "code". Use AuthorizationCodeResponseUrl to parse the redirect response after the end user grants/denies the request. Using the authorization code in this response, use AuthorizationCodeTokenRequest to request the access token.

Sample usage for a web application:

  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    String url =
        new AuthorizationCodeRequestUrl("https://server.example.com/authorize", "s6BhdRkqt3")
            .setState("xyz").setRedirectUri("https://client.example.com/rd").build();
    response.sendRedirect(url);
  }
 

Implementation is not thread-safe.

Since:
1.7