OAuthRequest


public final class OAuthRequest


The OAuth request to be sent to the server to start the OAuth 2 authentication flow.

Summary

Nested types

public final class OAuthRequest.Builder

Builder for constructing new instance of OAuth request.

Constants

static final @NonNull String

The default google-specific custom URL to route the response from the auth server back to the 1P companion app, which then forwards it to the 3P app that made the request on the wear device.

static final @NonNull String

The default google-specific custom URL in China to route the response from the auth server back to the 1P companion app, which then forwards it to the 3P app that made the request on the wear device.

Public methods

final @NonNull String

The package name of the app sending the auth request.

final @NonNull String

The redirect url the companion app is registered to.

final @NonNull Uri

The Url of the auth request.

Constants

WEAR_REDIRECT_URL_PREFIX

public static final @NonNull String WEAR_REDIRECT_URL_PREFIX

The default google-specific custom URL to route the response from the auth server back to the 1P companion app, which then forwards it to the 3P app that made the request on the wear device.

WEAR_REDIRECT_URL_PREFIX_CN

public static final @NonNull String WEAR_REDIRECT_URL_PREFIX_CN

The default google-specific custom URL in China to route the response from the auth server back to the 1P companion app, which then forwards it to the 3P app that made the request on the wear device.

Public methods

getPackageName

Added in 1.0.0
public final @NonNull String getPackageName()

The package name of the app sending the auth request.

getRedirectUrl

Added in 1.1.0-alpha05
public final @NonNull String getRedirectUrl()

The redirect url the companion app is registered to. If it doesn't exist, an empty string will be returned.

getRequestUrl

Added in 1.0.0
public final @NonNull Uri getRequestUrl()

The Url of the auth request.

The request is expected to create a URL with the following format:

    https://authorization-server.com/auth?client_id=XXXXX
&redirect_uri=https://wear.googleapis.com/3p_auth/mypackagename
&response_type=code
&code_challenge=XXXXX...XXX
&code_challenge_method=S256