public final class

AuthorizeRequest

extends InteractiveRequest<T extends InteractiveListener<S, U, V>, S, U, V>
java.lang.Object
   ↳ com.amazon.identity.auth.device.interactive.InteractiveRequest<T extends com.amazon.identity.auth.device.interactive.InteractiveListener<S, U, V>, S, U, V>
     ↳ com.amazon.identity.auth.device.api.authorization.AuthorizeRequest

Class Overview

Encapsulates the options for a call to authorize(AuthorizeRequest). The corresponding listener for this request is AuthorizeListener. See AuthorizeRequest.Builder for creating authorization requests.

By default, authorize requests:

{@since 3.0 }

Summary

Nested Classes
class AuthorizeRequest.Builder Instances of AuthorizeRequest must be constructed using this Builder
enum AuthorizeRequest.GrantType The different kinds of authorization grants that can be requested from Login With Amazon. 
Public Methods
void addScope(Scope scope)
Request a scope in addition to the current set of scopes.
void addScopes(Scope... scopesToAdd)
Request multiple scopes in addition to the current set of scopes.
void addWorkflow(Workflow workflow)
Request a workflow in addition to the current set of workflows.
void addWorkflows(Workflow... workflowsToAdd)
Request multiple workflows in addition to the current set of workflows.
String getCodeChallenge()
For authorization code flow.
String getCodeChallengeMethod()
For authorization code flow.
AuthorizeRequest.GrantType getGrantType()
By default, this is ACCESS_TOKEN.
final Class<AuthorizeListener> getListenerClass()
Do not call this API, it is for internal SDK usage only.
final Bundle getRequestExtras()
Do not call this API, it is for internal SDK usage only.
final String getRequestType()
Do not call this API, it is for internal SDK usage only.
List<Scope> getScopes()
The current set of scopes being requested.
List<Workflow> getWorkflows()
The current set of workflows being requested.
void setCodeChallenge(String codeChallenge)
Modifies the OAuth 2.0 proof key code challenge.
void setCodeChallengeMethod(String codeChallengeMethod)
Modifies the OAuth 2.0 proof key code challenge method.
void setGrantType(AuthorizeRequest.GrantType grantType)
Change the kind of result received upon authorization completion.
void setProofKeyParameters(String codeChallenge, String codeChallengeMethod)
Configure an authorization code request with a proof key for proof of possession, per RFC 7636.
void setScopes(List<Scope> scopes)
Replace the current set of scopes for this request with a new one.
void setShouldReturnUserData(boolean shouldReturnUserData)
Upon authorization, the default behavior is to fetch and return user profile data in the onSuccess(AuthorizeResult) via getUser().
void setWorkflows(List<Workflow> workflows)
Replace the current set of workflows for this request with a new one.
boolean shouldReturnUserData()
Indicates whether or not user profile data should be fetched upon authorization.
boolean shouldShowProgress()
Indicates whether to enable the dialog showing progress upon authorization.
void 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.
[Expand]
Inherited Methods
From class com.amazon.identity.auth.device.interactive.InteractiveRequest
From class java.lang.Object
From interface com.amazon.identity.auth.device.api.CancellableListener
From interface com.amazon.identity.auth.device.api.Listener
From interface com.amazon.identity.auth.device.interactive.InteractiveAPI
From interface com.amazon.identity.auth.device.interactive.InteractiveListener

Public Methods

public void addScope (Scope scope)

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

Parameters
scope The given scope to request for.

public void addScopes (Scope... scopesToAdd)

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

Parameters
scopesToAdd The given scopes to request for.

public void addWorkflow (Workflow workflow)

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

Parameters
workflow The given workflow to request for.

public void addWorkflows (Workflow... workflowsToAdd)

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

Parameters
workflowsToAdd The given workflows to request for.

public String getCodeChallenge ()

For authorization code flow. The proof key.

Returns
  • The OAuth 2.0 proof key code challenge, or null if there is none.

public String getCodeChallengeMethod ()

For authorization code flow. The proof key's derivation method.

Returns
  • The current code challenge method, or null if there is none.

public AuthorizeRequest.GrantType getGrantType ()

By default, this is ACCESS_TOKEN.

Returns
  • The current type of authorization grant requested.

public final Class<AuthorizeListener> getListenerClass ()

Do not call this API, it is for internal SDK usage only.

Returns
  • The Class of the listener type T.

public final Bundle getRequestExtras ()

Do not call this API, it is for internal SDK usage only.

Returns
  • A bundle containing your request's extra data to be passed back upon request completion, or null if no extras are to be passed.

public final String getRequestType ()

Do not call this API, it is for internal SDK usage only.

public List<Scope> getScopes ()

The current set of scopes being requested.

Returns
  • The set of scopes being requested, or an empty collection.

public List<Workflow> getWorkflows ()

The current set of workflows being requested.

Returns
  • The set of workflows being requested, or an empty collection.

public void setCodeChallenge (String codeChallenge)

Modifies the OAuth 2.0 proof key code challenge.

Parameters
codeChallenge The new code challenge to use.

public void setCodeChallengeMethod (String codeChallengeMethod)

Modifies the OAuth 2.0 proof key code challenge method.

Parameters
codeChallengeMethod The new code challenge method to use.

public void setGrantType (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.

public void setProofKeyParameters (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".

public void setScopes (List<Scope> scopes)

Replace the current set of scopes for this request with a new one.

Parameters
scopes The new set of scopes to be requested.

public void setShouldReturnUserData (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.

public void setWorkflows (List<Workflow> workflows)

Replace the current set of workflows for this request with a new one.

Parameters
workflows The new set of workflows to be requested.

public boolean shouldReturnUserData ()

Indicates whether or not user profile data should be fetched upon authorization. By default, this is true.

Returns
  • true if user profile data is going to be returned, false otherwise.

public boolean shouldShowProgress ()

Indicates whether to enable the dialog showing progress upon authorization. By default, this is true

Returns
  • true if progress dialog is turn on, false otherwise.

public void 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 progress dialog, false to turn off.