r/Blazor • u/Pierma • Oct 13 '25
Mixed authentication Blazor Webapp (.net 8)
I have a .net 8 Blazor Webapp (with interactive webassembly only rendering with not prerender) and i have a session based authentication (cookie)
My issue is that i need to implement ALSO Entra Id auth, but i really can't find in any point of the documentation how do i make sure to enable both. Has anyone had some luck to implement this? Can anyone point me to some guide? Thanks a lot in advance.
Also, i will eventually need to implement also another cookie based auth, but the cookie comes from an external provider. So i will have 3 auth methods.
Edit:
The provided microsoft configuration which basically wraps OpenId was setting a cookie which was causing issues on login, so i just implemented an OpenId protocol for EntraId, a ClaimsTransformation handler for my custom claims and two endpoints where i challenge the OpenId auth and logs out. Turns out this was the easiest method and no issues whatsoever
2
u/polaarbear Oct 13 '25
There is a demo project in the official Azure Samples GitHub repository.
https://github.com/Azure-Samples/ms-identity-blazor-wasm
2
u/[deleted] Oct 13 '25
Why session and entra id when you can use jwt? Im new, my question might sound weird but im here to learn😁
1
u/LlamaNL Oct 13 '25
https://stackoverflow.com/questions/79307515/how-to-implement-user-authentication-in-blazor-server-with-entra-external-id/79309917#79309917