-
Notifications
You must be signed in to change notification settings - Fork 10.3k
SPA template issues with Individual authentication when running in production #42072
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
Comments
Tested with Started of by adding a new Application settings for the Azure App Service called
below this code:
I have not verified if it matters where the code is placed but After doing this the app still failed with the same error. I then modified
and then it started working for me. If you still experience a problem you could also try to set
|
Thanks for contacting us. We're moving this issue to the |
@Rick-Anderson can we add these other two examples to the release notes for 6 here perhaps as a in production section? https://github.com/dotnet/core/blob/main/release-notes/6.0/known-issues.md#spa-template-issues-with-individual-authentication-when-running-in-development?
Or:
|
Is there an existing issue for this?
Describe the bug
This is probably related to:
#28880
Since that conversation is "locked as resolved and limited to collaborators." with a link to documentation stating "SPA template issues with Individual authentication when running in development" I have created a new issue.
https://github.com/dotnet/core/blob/main/release-notes/6.0/known-issues.md#spa-template-issues-with-individual-authentication-when-running-in-development
This does not only happen in development but in production environments as well and should imao be prioritized. I have a personal application that is hosted as an Azure App Service and it is not used every week. I always access it via a custom domain like example.com. However sometimes I can not authenticate when I start using the application, I only receive this error:
WWW-Authenticate: Bearer error="invalid_token", error_description="The issuer 'https://example.com' is invalid"
If I then access the application via example.azurewebsites.net I can use it like normal. Since the application is not always used I have
Always on
set to false. I can not remove the domain example.azurewebsites.net from an Azure App Service.https://docs.microsoft.com/en-gb/azure/app-service/configure-common?tabs=portal#configure-general-settings
I have only noticed it with the application that requires login for every page though. I have another personal project that has a public part and another part behind login using the exact same template and technologies. It does not happen there.
I'm using the code below to always redirect to login if the user is not authenticated:
https://stackoverflow.com/a/65854313/3850405
Since it is on the server it does not help to clean any browser cache or anything similar. Then only thing that helps is manually stopping the App Service and then Start it again. Then everything works as expected.
Expected Behavior
An application in production should be able to go idle and login should work when the application is accessed again
Steps To Reproduce
Create a new Blazor Webassembly App with Individual Accounts and ASP.NET Core hosted from Visual Studio.
Follow the guide below to redirect to login if a user is not authenticated
https://stackoverflow.com/a/65854313/3850405
Host the application on Azure as an App Service and then wait
Exceptions (if any)
No response
.NET Version
6.0.300
Anything else?
ASP.NET Core 6.0.5
Microsoft Visual Studio 2022 (64-bit) - Version 17.2.2
The text was updated successfully, but these errors were encountered: