V16 RC: getOpenApiConfiguration().token does not work#19217
Merged
leekelleher merged 3 commits intorelease/16.0from May 6, 2025
Merged
V16 RC: getOpenApiConfiguration().token does not work#19217leekelleher merged 3 commits intorelease/16.0from
leekelleher merged 3 commits intorelease/16.0from
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR reverts a change in how the token is accessed from the OpenAPI configuration to proxy the token through the AuthContext as in V15, and updates context types to handle potentially undefined values.
- Reverts the direct token property access to using a function call in auth.context.ts.
- Updates optional chaining and type annotations in entrypoint.ts and dashboard.element.ts to account for revoked contexts.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| templates/UmbracoExtension/Client/src/entrypoints/entrypoint.ts | Reverts token access to use optional chaining and ensures safer config extraction. |
| templates/UmbracoExtension/Client/src/dashboards/dashboard.element.ts | Updates state properties to reflect optional contexts and removes duplicate notification context declaration. |
| src/Umbraco.Web.UI.Client/src/packages/core/auth/auth.context.ts | Wraps the getLatestToken call in a function to avoid direct access to a private member. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
One line accidentally got changed compared to V15, so getting the latest token through the helpful "openApiConfiguration" object was no longer possible.
This pull request reverts the line to V15, where the token is proxied through the AuthContext, so we don't accidentally call a private member of AuthFlow.
Additionally, I have updated the umbraco-extension template to reflect that all contexts are now potentially undefined, because they can be revoked.
This fixes #19207
How to test
Go to a random element like the umbraco-news-dashboard.element.ts and test that you can get the token through the two officially supported methods:
You should see token 1 and token 2 logged to the console.