AuthorizationManager
Manages the interaction with the LWATurboModules (Login with Amazon). This class provides methods to register event listeners, obtain tokens, authorize users, retrieve user information, and sign out.
Constructors
new AuthorizationManager()
new AuthorizationManager():
AuthorizationManager
Returns
Methods
authorize()
static
authorize(authorizeRequest
,authorizeCallbacks
?):void
Performs authorization (using OAuth 2.0) using the specified scopes in the AuthorizeRequest object. By default, an Amazon-hosted WebView is used to present a page that prompts the user to authorize the application. To be notified when the authorization flow has finished, register an AuthorizeCallbacks on the request. The user should provide consent for these scopes before this authorization call. This method will initiate the OAuth flow.
Parameters
authorizeRequest
Object containing the scopes for which authorization is requested. The user must grant consent for these scopes.
authorizeCallbacks?
Optional callbacks to handle authorization success, failure, or cancellation.
Returns
void
Throws
- Throws an error if
keplerLWATurboModules
is not available.
getToken()
static
getToken(getTokenCallbacks
?):void
Requests an authorization token (using OAuth 2.0).
The authorize
API 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.
Parameters
getTokenCallbacks?
Optional callbacks to handle token retrieval success or failure.
Returns
void
Throws
- Throws an error if
keplerLWATurboModules
is not available.
getUser()
static
getUser(getUserCallbacks
?):void
Retrieves basic profile information for a user (using OAuth 2.0) for the scopes requested in the last call to authorize
API.
The authorize method must have been called once prior to this call so that a user can authorize the app.
If the app has restarted since the last authorize call, this may still succeed using the cached profile data and/or credentials.
Parameters
getUserCallbacks?
This is mandatory on the first call and it gets registered internally. For the subsequent calls it is optional. If provided it would take the given callback if not whatever was registered previously.
Returns
void
- This method does not return a value. Instead, it uses callbacks to handle success or failure.
signOut()
static
signOut(signOutCallbacks
?):void
Removes any local authorization for the current user from this application. This method will sign out the user by clearing local credentials and cached authorization tokens. User must call authorize again to get tokens or user profile information.
Parameters
signOutCallbacks?
This is mandatory on the first call and it gets registered internally. For the subsequent calls it is optional. If provided it would take the given callback if not whatever was registered previously.
Returns
void
- This method does not return a value. Instead, it uses callbacks to handle success or failure.
Last updated: Oct 02, 2025