@Matthew Scheetz
I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.Issue:
.net Blazor app stuck on on B2C Redirect Url after successful login, some users are getting redirected to the redirect url:
https://example.com/signin-oidc
Solution:
You have fixed this issue by following
Added middleware to intercept requests to/signin-oidc
and/MicrosoftIdentity/Account/Error
and redirect back to home page
- Added empty razor page with path of /
signin-oidc
and/MicrosoftIdentity/Account/Error
My home page auto redirects to/MicrosoftIdentity/Account/SignIn
if the user is not authenticated. Any of the requests coming to/signin-oidc
are not registered as authenticated, the home page re directs them to b2c login, and they are quickly returned to the home page and logged in. Good user path:- Navigate to
https://www.example.com
- User not authenticated and auto-redirected to b2c login
- Enter Credentials & 2FA
- Redirected and logged into
https://www.example.com
Troublesome user path:- Navigate to
https://www.example.com
- Auto-redirected to b2c login
- Enter Credentials & 2FA
- Redirected and not logged into
https://www.example.com/signin-oidc
- Middleware redirects to
https://www.example.com
- User not authenticated and auto-redirected to b2c login
- No inputs are required here
- Redirected and logged into
https://www.example.com
- Added middleware to intercept requests to
/signin-oidc
and/MicrosoftIdentity/Account/Error
and redirect back to home page
- Added empty razor page with path of /
signin-oidc
and/MicrosoftIdentity/Account/Error
My home page auto redirects to/MicrosoftIdentity/Account/SignIn
if the user is not authenticated. Any of the requests coming to/signin-oidc
are not registered as authenticated, the home page re directs them to b2c login, and they are quickly returned to the home page and logged in. Good user path:- Navigate to
https://www.example.com
- User not authenticated and auto-redirected to b2c login
- Enter Credentials & 2FA
- Redirected and logged into
https://www.example.com
Troublesome user path:- Navigate to
https://www.example.com
- Auto-redirected to b2c login
- Enter Credentials & 2FA
- Redirected and not logged into
https://www.example.com/signin-oidc
- Middleware redirects to
https://www.example.com
- User not authenticated and auto-redirected to b2c login
- No inputs are required here
- Redirected and logged into
https://www.example.com
If you have any other questions or are still running into more issues, please let me know. Thank you again for your time and patience throughout this issue.
Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.