-
Notifications
You must be signed in to change notification settings - Fork 25.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cookie example does not work for .Net 8 template because the state container does not instantiate in user scope #31899
Comments
💘 Hello, February! Goodbye, New Year's resolutions! 😆A green dinosaur 🦖 will be along shortly to assist. Stand-by ........ |
Hello @kaleidocore ... This is a duplicate of #31691. Although I've pinged engineering for assistance with it, I haven't heard back yet. I'll take two actions...
|
One more thing ... depending on what ur trying to implement, take a look at our new article and samples for BWAs with OIDC at ... |
@guardrex Thanks for the very quick reply and suggestion! I was actually not trying to implement authentication but rather theming and localization, which are also based on cookies before first render to avoid FOUC. I did however (independently) discover the workaround suggested in the #31691 (comment) in the duplicate post. Sorry for the dupe! |
For managing localization in a BWA, see the PR that I just put up this morning, and my test app is linked there. Perhaps, it will help with your project. |
Re-opening for work now that we have knowledge of ... https://github.com/javiercn/BlazorWebNonceService/ ... via the PU issue. I'll probably work this along with #31691 on the same PR. I hope to reach this work within the next few days. |
Just FYI, the persist pattern also does not work in this case because the root component never re-renders in user-scope, or at all for that matter. |
There was no need for me to re-open this. The additional information applied to a different issue. The sample app has been updated for the nonce problem. This will be tracked by #31691, and I hope that they'll get to it soon 🤞. |
Description
This example does not seem to work with the .Net 8 Blazor template, i.e. when using the new type of server-interactive rendering.
The reason is that the root App component does not render in user-scope, but rather in some anonymous pre-render scope that you cannot disable. This causes the state container (TokenProvider service) to instantiate once for the App component while a different (user-scoped) instance is created for the consuming component.
Page URL
https://learn.microsoft.com/en-us/aspnet/core/blazor/security/server/additional-scenarios?preserve-view=true&view=aspnetcore-8.0#pass-tokens-to-a-server-side-blazor-app
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/security/server/additional-scenarios.md
Document ID
c98be365-408d-7ee6-cb74-14c44d01b0b8
Article author
@guardrex
The text was updated successfully, but these errors were encountered: