I am currently writing an app in ASP.Net Core 3.1. Everything has been working fine on localhost (IIS Express) for weeks, but all of a sudden, my authentication has stopped working.
I am using AzureADB2C for authentication. Whenever my app needs to redirect to the login page, I get the following error in Edge/Chrome.
Hmmm… can't reach this page
It looks like the webpage at https://localhost:44344/ might be having issues, or it may have moved permanently to a new web address.
ERR_HTTP2_PROTOCOL_ERROR
The browser also displays a warning telling me that the Connection to this site isn't secure
When I use the Azure Portal to test my user flow, I can see that Azure is redirecting me back to https://localhost:44344/AzureADB2C/Account/Error#id_token=eyJ0{snip}. The token actually seems to be valid, but I am not sure why Azure is redirecting to an error page.
Here are my Azure Ad B2C settings
"AzureAdB2C": {
"Instance": "https://MY_COMPANY_NAME.b2clogin.com",
"ClientId": "MY_CLIENT_ID",
"CallbackPath": "/signin-oidc",
"Domain": "MY_COMPANY_NAME.onmicrosoft.com",
"SignUpSignInPolicyId": "B2C_1_SignUpSignIn",
"ResetPasswordPolicyId": "B2C_1_PasswordReset",
"EditProfilePolicyId": ""
},
Everything was working perfectly fine this morning. After restarting my PC, I launched Visual Studio, and my app would no longer work. I tested my app on another PC, and got the same errors.
UPDATE: After testing my user flow in the Azure Portal, with my local app not running, it looks like Azure is correctly redirecting back to https://localhost:44344/signin-oidc#id_token={token}. So the redirect to the error page is happening within the auth middleware. No errors are written to the output window, so I have no idea what is going wrong.
I tried rolling back my app to a previous commit from a week ago, but I am still seeing the same issue with older code that used to work.