java.lang.Object | |
↳ | com.amazon.identity.auth.device.api.authorization.AuthorizationManager |
Clients of Login With Amazon use this class to authorize Amazon customers and retrieve authorization grants. In order to use any APIs of AuthorizationManager, your application must have configured an APIKey, see below.
All methods that return results in an asynchronous manner will do so in a non-UI thread.
To retrieve Amazon customer profile data, see the User
class.
APIKey:
The "APIKey" is a token meant to encode claims about a native application(e.g. Android, iOS) that can be used to
verify the identity of the application without requiring a remote service call. In addition to the app identity,
these tokens can carry other claims about the application as required. For example, a list of permissions granted
to the application. The contents of the tokens are encoded and then digitally signed. The APIKey must be available
for the SDK to obtain from the calling application.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Performs authorization (using OAuth 2.0) using the given
AuthorizeRequest . | |||||||||||
Gets the region the SDK is using to connect to the server endpoints.
| |||||||||||
Requests an authorization token (using OAuth 2.0) for the specified scopes.
| |||||||||||
Inspect whether the Login With Amazon SDK is operating with non-production sandbox test customer accounts.
| |||||||||||
Sets the region for the SDK.
| |||||||||||
Configure the Login With Amazon SDK to be in sandbox mode.
| |||||||||||
Removes any local authorization for the current user from this application.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Performs authorization (using OAuth 2.0) using the given AuthorizeRequest
.
By default, a native browser is used to present a page that prompts the user to login and authorize the
application. If SSO is available, an Amazon-hosted WebView
will be used instead of a
native browser.
To be notified when the authorization flow has finished, register an AuthorizeListener
on the
RequestContext
that the request
was created with.
request | Required. The request to perform authorize for. |
---|
IllegalArgumentException | If there were no scopes provided in the request . |
---|
Gets the region the SDK is using to connect to the server endpoints.
If the region was set to Region.AUTO
then method will return the region SDK translated it into.
context | Required. |
---|
Region
the SDK is using.Requests an authorization token (using OAuth 2.0) for the specified scopes.
The authorize(AuthorizeRequest)
method must have been called successfully with the same scopes, and the
user must have granted consent to those scopes once, prior to this call, in order to get a token.
If the app has restarted since the last authorize call, getToken may still succeed using the cached credentials.
context | Required. |
---|---|
scopes | An array of Scope representing the permissions requested by this application.
See ProfileScope for the scopes declared by Login With Amazon. |
listener | Callback that returns an AuthorizeResult on success or an AuthError on failure.
onError(U) will be called for the following OAuth-related errors:
ERROR_ACCESS_DENIED will be returned.
Any other possible OAuth-related errors will be encapsulated in a
|
Inspect whether the Login With Amazon SDK is operating with non-production sandbox test customer accounts.
Configure the Login With Amazon SDK to be in sandbox mode. In sandbox mode, the
authorize(AuthorizeRequest)
API will prompt sign in for only non-production sandbox test customer
accounts. By default, sandbox mode is disabled.
If the value of useSandbox
is different than the current sandbox setting, then this API implicitly
performs signOut(Context, Listener)
to clear all local auth state. When this happens, this API will
block on the completion of signOut.
The sandbox setting is persisted across restarts of the application through Android SharedPreferences.
context | Required. |
---|---|
useSandbox | true to enable sandbox mode, false to disable sandbox mode. |
Removes any local authorization for the current user from this application. Your application must call
authorize(AuthorizeRequest)
again to be able to get tokens (via
getToken(Context, Scope[], Listener)
) or profile data (via fetch(Context, Listener)
).
context | Required. |
---|---|
listener | Callback that returns an AuthError upon failure. onError(U) will be called
for the following errors:
|