Skip to content

Commit 931dd68

Browse files
docs: document CTE state parity and backward compatibility
1 parent d8cdac6 commit 931dd68

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

EXAMPLES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export default TokenExchange;
152152
- The external token must be validated in Auth0 Actions using strong cryptographic verification
153153
- This method implements RFC 8693 token exchange grant type
154154
- The audience and scope can be provided directly in the options or will fall back to SDK defaults
155+
- **State Management:** This method triggers the `GET_ACCESS_TOKEN_COMPLETE` action internally upon completion. This ensures that the SDK's `isLoading` and `isAuthenticated` states behave identically to the standard `getAccessTokenSilently` flow.
155156

156157
## Protecting a route in a `react-router-dom v6` app
157158

src/auth0-provider.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,10 @@ const Auth0Provider = <TUser extends User = User>(opts: Auth0ProviderOptions<TUs
289289
} catch (error) {
290290
throw tokenError(error);
291291
} finally {
292+
// We dispatch the standard GET_ACCESS_TOKEN_COMPLETE action here to maintain
293+
// backward compatibility and consistency with the getAccessTokenSilently flow.
294+
// This ensures the SDK's internal state lifecycle (loading/user updates) remains
295+
// identical regardless of whether the token was retrieved via silent auth or CTE.
292296
dispatch({
293297
type: 'GET_ACCESS_TOKEN_COMPLETE',
294298
user: await client.getUser(),

0 commit comments

Comments
 (0)