Skip to content
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

Blazor 8 after passing authentication check the browser appears to keep reauthenticating... #1032

Closed
GX2AG opened this issue Dec 8, 2023 · 5 comments

Comments

@GX2AG
Copy link

GX2AG commented Dec 8, 2023

Which version of Duende IdentityServer are you using?
6

Which version of .NET are you using?
8

Describe the bug
I have a Blazor Server app that, after I authenticate with Identity Server, the progress spinner for the tab keeps restarting and the page stays white and never routes.

A clear and concise description of what the bug is.
When the user open a page that has the Authorize Attribute, they are routed to the Identity Server login. After completing the login, where they should be routed back to the site, the browser tab appears to keep resubmitting the auth request over and over. The log file quickly grows with login attempts. This also occurs on the Duende Test Api.

To Reproduce

Steps to reproduce the behavior.

See included video

msedge_HzJAwhU8qH.mp4

Expected behavior

A clear and concise description of what you expected to happen.

I expected the page to be authenticated and the user routed to the page.

Log output/exception with stacktrace

data

Additional context

Add any other context about the problem here.

@josephdecock
Copy link
Member

This looks like session at the blazor application is not starting, but the session at IdentityServer is starting. So, you're getting redirected back and forth endlessly - the blazor app has no session, issues a challenge, you're redirected to IdentityServer, IdentityServer has a session, so it immediately responds with a token, then the app fails to start its own session and instead issues another challenge, and this behavior loops indefinitely.

I'm not sure why your application isn't starting its session correctly, but a good place to start is our documentation on blazor server applications in the Duende.AccessTokenManagement client library, and the accompanying sample application.

@AndersAbel
Copy link
Member

@GX2AG Do you have any updates on this? Any more questions? If not, we'd like to close the issue.

@GX2AG
Copy link
Author

GX2AG commented Jan 16, 2024 via email

@GX2AG
Copy link
Author

GX2AG commented Jan 16, 2024

When I log into the site form the homepage, I can get authenticated and routed back to the home page. The site does not know that I have authenticated until I route somewhere else in the site. I am not sure why routing back would not know I am authenticated now.

In addition, If I initially route to a different page from the home page, I get the spinning call back stuff again. It seems that I have to route to the home page to log in. Why can I not route to a different page and get authenticated?

@josephdecock
Copy link
Member

Sorry for the delay in getting back to you @GX2AG! We are actively working on an update to the BFF and new samples to show how to solve auth issues in blazor with .NET 8, which I'm hoping will help you as well. For more details on my thoughts about the problems we're working on, see this comment, and this open issue in our samples repo. In the interest of keeping things organized, I'm closing this along with some other related issues, but feel free to provide feedback and comments in (DuendeSoftware/Samples#142)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants