A promise that resolves to the token endpoint response, which contains the issued Auth0 tokens.
This method implements the token exchange grant as specified in RFC 8693 by first validating the provided subject token type and then constructing a token request to the /oauth/token endpoint. The request includes the following parameters:
grant_type
: Hard-coded to "urn:ietf:params:oauth:grant-type:token-exchange".subject_token
: The external token provided via the options.subject_token_type
: The type of the external token (validated by this function).scope
: A unique set of scopes, generated by merging the scopes supplied in the options with the SDK’s default scopes.audience
: The target audience from the options, with fallback to the SDK's authorization configuration.Example Usage:
// Define the token exchange options
const options: CustomTokenExchangeOptions = {
subject_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6Ikp...',
subject_token_type: 'urn:acme:legacy-system-token',
scope: "openid profile"
};// Exchange the external token for Auth0 tokens
try {
const tokenResponse = await instance.exchangeToken(options);
// Use tokenResponse.access_token, tokenResponse.id_token, etc.
} catch (error) {
// Handle token exchange error
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4