OAuthRequest.Builder

public final class OAuthRequest.Builder


Builder for constructing new instance of OAuth request.

Summary

Public constructors

Builder(Context context)

Public methods

final @RequiresApi(value = 26) @NonNull OAuthRequest

Build the request instance specified by this builder

final @NonNull OAuthRequest.Builder
setAuthProviderUrl(Uri authProviderUrl)

Set the url of the auth provider site.

final @NonNull OAuthRequest.Builder
setClientId(String clientId)

Set the client id of this OAuth request.

final @NonNull OAuthRequest.Builder

Set the code challenge for authentication with PKCE (proof key for code exchange).

final @NonNull OAuthRequest.Builder
setRedirectUrl(Uri redirectUrl)

Set the redirect url the companion app registered to, so that the response will be routed from the auth server back to the companion.

Public constructors

Builder

public final Builder(Context context)
Parameters
Context context

The Context of the app sending the auth request.

Public methods

build

@RequiresApi(value = 26)
public final @NonNull OAuthRequest build()

Build the request instance specified by this builder

setAuthProviderUrl

public final @NonNull OAuthRequest.Builder setAuthProviderUrl(Uri authProviderUrl)

Set the url of the auth provider site. Appending query parameters in this uri is optional, it is recommended to let the builder append query parameters automatically through the use of setters (no setter is required for the builder to append the redirect_uri).

setClientId

public final @NonNull OAuthRequest.Builder setClientId(String clientId)

Set the client id of this OAuth request. With this setter called. the builder appends the "client_id" to the requestUrl.

setCodeChallenge

public final @NonNull OAuthRequest.Builder setCodeChallenge(CodeChallenge codeChallenge)

Set the code challenge for authentication with PKCE (proof key for code exchange). With this setter called, the builder appends the "code_challenge", "code_challenge_method" and "response_type" queries to the requestUrl.