question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AzureADB2C.UI doesn't allow customizing post-logout redirect URI

See original GitHub issue

I’m using Microsoft.AspNetCore.Authentication.AzureADB2C.UI to provide B2C login in a (server-side) Blazor app. The problem is that after the user logs out (by navigating to AzureADB2C/Account/SignOut), they are logged out and redirected back to a generic ‘signed out’ page at /AzureADB2C/Account/SignedOut.

I would like to be able to customize where the user is redirected back to after logout, but my app is just a simple SPA and I’d rather not add controllers or extra pages just for that functionality. If it were possible to configure the callback URL used by the AzureADB2C.UI library, that would solve the issue.

I’ve worked around the issue by re-writing calls to /AzureADB2C/Account/SignedOut using app.UseRewriter as suggested on StackOverflow. It seems like making AzureADB2C.UI’s callback URL configurable would be an even cleaner solution, though.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jH-commented, Jan 7, 2021

@MauriRojas Made some changes to this, seems to work:

options.Events.OnSignedOutCallbackRedirect = async context =>
{
    context.HttpContext.Response.Redirect(context.Options.SignedOutRedirectUri);
    context.HandleResponse();
};

Redirects to root by default, set SignedOutRedirectUri if you’re using a custom logout component.

1reaction
mjrousoscommented, Feb 10, 2020

You can use IApplicationBuilder.UseRewriter to redirect requests to /AzureADB2C/Account/SignedOut to a different URL. Here’s the code I added towards the beginning of my Startup.Configure method to use the rewriter:

app.UseRewriter(new RewriteOptions().AddRedirect("AzureADB2C/Account/SignedOut", "/"));
Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure AD B2C Sign-out issue
In 1 you have my 2 redirect URLs (if I don't put the sign-out URL here, I got an error saying that "the...
Read more >
Azure AD B2C does not respect redirect_uri
Azure AD B2C does not always respect the redirect_uri specified in the authentication request using the authorization code flow.
Read more >
Integrate Azure AD B2C with ASP.NET MVC Web App
The PostLogoutRedirectUri property will inform Azure AD B2C where to redirect the browser after a sign out operation completed successfully. The ...
Read more >
Released DNN Azure AD B2C Provider v1.2
Added a new "Redirect Uri" setting to allow customization of the redirection after a user login; Added a Redirection Controller to handle the...
Read more >
Post_Logout_Redirect_Uri does not redirect when ...
The URI you are using as a post logout redirect must be specified in both the reply URLs and as the Front Channel...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found