public static final class

AuthorizeRequest.Builder

extends InteractiveRequest.Builder<W extends InteractiveRequest<?, ?, ?, ?>>
java.lang.Object
   ↳ com.amazon.identity.auth.device.interactive.InteractiveRequest.Builder<W extends com.amazon.identity.auth.device.interactive.InteractiveRequest<?, ?, ?, ?>>
     ↳ com.amazon.identity.auth.device.api.authorization.AuthorizeRequest.Builder

Class Overview

Instances of AuthorizeRequest must be constructed using this Builder.

Summary

[Expand]
Inherited Fields
From class com.amazon.identity.auth.device.interactive.InteractiveRequest.Builder
Public Constructors
Builder(RequestContext context)
Requires that the RequestContext that this request's listeners are registered to.
Public Methods
AuthorizeRequest.Builder addScope(Scope scope)
Request a scope in addition to the current set of scopes.
AuthorizeRequest.Builder addScopes(Scope... scopes)
Request multiple scopes in addition to the current set of scopes.
AuthorizeRequest.Builder addWorkflow(Workflow workflow)
Request a workflow in addition to the current set of workflows.
AuthorizeRequest.Builder addWorkflows(Workflow... workflows)
Request multiple workflows in addition to the current set of workflows.
AuthorizeRequest build()
Build the request instance specified by this builder.
AuthorizeRequest.Builder forGrantType(AuthorizeRequest.GrantType grantType)
Change the kind of result received upon authorization completion.
AuthorizeRequest.Builder shouldReturnUserData(boolean shouldReturnUserData)
Upon authorization, the default behavior is to fetch and return user profile data in the onSuccess(AuthorizeResult) via getUser().
AuthorizeRequest.Builder showProgress(boolean showProgress)
On FireOS or Android devices which have the Amazon Shopping APP installed,, upon authorization, there will be a consent page asking customers to grant permission for the specified scopes of his Amazon account to your APP, and there should be a progress animation indicating data fetch from LWA.
AuthorizeRequest.Builder withProofKeyParameters(String codeChallenge, String codeChallengeMethod)
Configure an authorization code request with a proof key for proof of possession, per RFC 7636.
[Expand]
Inherited Methods
From class com.amazon.identity.auth.device.interactive.InteractiveRequest.Builder
From class java.lang.Object

Public Constructors

public Builder (RequestContext context)

Requires that the RequestContext that this request's listeners are registered to.

Parameters
context Required.

Public Methods

public AuthorizeRequest.Builder addScope (Scope scope)

Request a scope in addition to the current set of scopes.

Parameters
scope The given scope to request for.
Returns
  • Builder for chaining.

public AuthorizeRequest.Builder addScopes (Scope... scopes)

Request multiple scopes in addition to the current set of scopes.

Parameters
scopes The given scopes to request for.
Returns
  • Builder for chaining.

public AuthorizeRequest.Builder addWorkflow (Workflow workflow)

Request a workflow in addition to the current set of workflows.

Parameters
workflow The given workflow to request for.
Returns
  • Builder for chaining.

public AuthorizeRequest.Builder addWorkflows (Workflow... workflows)

Request multiple workflows in addition to the current set of workflows.

Parameters
workflows The given workflows to request for.
Returns
  • Builder for chaining.

public AuthorizeRequest build ()

Build the request instance specified by this builder.

Returns
  • The instance of the specified request.

public AuthorizeRequest.Builder forGrantType (AuthorizeRequest.GrantType grantType)

Change the kind of result received upon authorization completion. By default, this is ACCESS_TOKEN.

Parameters
grantType The kind of authorization grant to request.
Returns
  • Builder for chaining.

public AuthorizeRequest.Builder shouldReturnUserData (boolean shouldReturnUserData)

Upon authorization, the default behavior is to fetch and return user profile data in the onSuccess(AuthorizeResult) via getUser(). If this is set to false then user profile data is not returned, and the authorize request will finish without incurring the cost of retrieving user profile data.

It may be desired to override the default behavior using this method in cases where user profile data is not desired, if no scopes for profile data are being requested, or if it is preferable to defer fetching of user profile data.

Parameters
shouldReturnUserData true to fetch return user data, false otherwise.
Returns
  • Builder for chaining.

public AuthorizeRequest.Builder showProgress (boolean showProgress)

On FireOS or Android devices which have the Amazon Shopping APP installed,, upon authorization, there will be a consent page asking customers to grant permission for the specified scopes of his Amazon account to your APP, and there should be a progress animation indicating data fetch from LWA. If you don't want to show the consent page and spinner, you can use this API to turn it off. Note that if this flag is set false, the LWA authorization will fail, if the customer didn't grant permission for the specified scopes of his Amazon account to your APP yet. By default, the consent page and animation is enabled.

Parameters
showProgress true to turn on the dialog, false to turn off it.
Returns
  • Builder for chaining.

public AuthorizeRequest.Builder withProofKeyParameters (String codeChallenge, String codeChallengeMethod)

Configure an authorization code request with a proof key for proof of possession, per RFC 7636.

Parameters
codeChallenge The OAuth 2.0 code challenged derived using the given codeChallengeMethod.
codeChallengeMethod The method used to derive the codeChallenge, such as "S256".
Returns
  • Builder for chaining.