Emitted when the authenticated state changes. AuthorizationManager.events#authenticated
Emitted when the user revokes their authentication. AuthorizationManager.events#revoke
The storage system used by the AuthorizationManager.
The AuthorizationManager is considered authenticated if it has a valid Globus Auth token.
It does not necessarily mean that it has a valid token for a specific resource server.
Set the authenticated state and emit the authenticated event.
The user information decoded from the id_token (JWT) of the current Globus Auth token.
This method can be used instead of auth.oauth2.userinfo to get the user information without an additional request.
IMPORTANT: The id_token can only be processed if the openid scope is requested during the authorization process.
Additionally, the profile and email scopes are required to get the full user information.
Add a Globus Auth token response to storage, if other_tokens are present they are also added.
This method is mostly used internally by the AuthorizationManager, but can be used by downstream
consumers to add tokens to storage if necessary.
Retrieve the Globus Auth token managed by the instance.
Process a well-formed Authorization Requirements error response from a Globus service and redirect the user to the Globus Auth login page with the necessary parameters.
Optionaloptions: { additionalParams?: { [key: string]: string } }This method will attempt to complete the PKCE protocol flow.
Process a well-formed ConsentRequired error response from a Globus service
and redirect the user to the Globus Auth login page with the necessary parameters.
Optionaloptions: { additionalParams?: { [key: string]: string } }Handle an error response from a Globus service in the context of this AuthorizationManager.
This method will introspect the response and attempt to handle any errors that should result
in some additional Globus Auth interaction.
The error response from a Globus service.
Optionaloptions: true | { additionalParams?: { [key: string]: string }; execute?: true }Options for handling the error response. If a boolean is provided, this will be treated as the options.execute value.
OptionaladditionalParams?: { [key: string]: string }Additional query parameters to be included with the transport generated URL.
Optionalexecute?: trueWhether to execute the handler immediately.
Handle an error response from a Globus service in the context of this AuthorizationManager.
This method will introspect the response and attempt to handle any errors that should result
in some additional Globus Auth interaction.
The error response from a Globus service.
Optionaloptions: false | { additionalParams?: { [key: string]: string }; execute?: false }Options for handling the error response. If a boolean is provided, this will be treated as the options.execute value.
OptionaladditionalParams?: { [key: string]: string }Additional query parameters to be included with the transport generated URL.
Optionalexecute?: falseWhether to execute the handler immediately.
Whether or not the instance has a reference to a Globus Auth token.
Initiate the login process by redirecting to the Globus Auth login page.
IMPORTANT: This method will reset the instance state before initiating the login process,
including clearing all tokens from storage. If you need to maintain the current state,
use the AuthorizationManager.prompt() method.
Use the refresh_token attribute of a token to obtain a new access token.
The well-formed token with a refresh_token attribute.
Attempt to refresh all of the tokens managed by the instance.
This method will only attempt to refresh tokens that have a refresh_token attribute.
Reset the authenticated state and clear all tokens from storage.
This method does not emit the revoke event. If you need to emit the revoke event, use the AuthorizationManager.revoke method.
Provides management of Globus authorization context for your application.
ConsentRequired,authorization_requirements)Once you configure your instance, you can determine the authenticated state using
manager.authenticated.To prompt a user to authenticate, call
manager.login()on user interaction – this will initiate the OAuth protocol flow with your configured client and scopes, resulting in an initial redirect to Globus Auth.Once the user authenticates with Globus Auth, they will be redirected to your application using the configured
redirectURL. On this URL, you will need to callmanager.handleCodeRedirect(using a manager instance configured in the same manner that initiated themanager.login()call) to complete the PKCE flow, exchanging the provided code for a valid token, or tokens.All tokens managed by the
AuthorizationManagerinstance can be found onmanager.token.Registering your Globus Application
The
AuthorizationManagerexpects your Globus Application to be registered as an OAuth public client. In this Globus Web Application, this option is referenced as "Register a thick client or script that will be installed and run by users on their devices".Example: Creating an AuthorizationManager instance.
Usage with Service Methods
Once you have an instance of an
AuthorizationManager, it can be passed to any service method asServiceMethodOptions.managerorSDKOptions.manageroption. The service method will determine if a token is required to make the request and will use theAuthorizationManagerto retrieve the token.Example: Using the AuthorizationManager with a service method.