Blazor Server App, OIDC, Logout IDP Duende, PostLogoutRedirectUri Null

Posted 150 days ago by Sinistancer
0

Hi,

How to implement logout process when using Blazor Web App (Server), authority with IDP Duende ?

Data in DB for PostLogoutRedirectUri successfully added, can check here:
https://ibb.co/GVdrLJQ

but when logout process PostLogoutRedirectUri always null, can check here :
https://ibb.co/JrMmP7v

Logout process Blazor Web App :

private void Logout()
{
    NavigationManager.NavigateTo($"https://localhost:5445/Account/Logout");
}

My setup client in Duende IDP like this:

new Client
{
    ClientId = "sitantewebapp",
    ClientSecrets = {new Secret("sitantewebappsecret".Sha256())},

    AllowedGrantTypes = GrantTypes.Code,

    //PORT WEB CLIENT SITANTE
    RedirectUris = { "https://localhost:7275/signin-oidc" },
    FrontChannelLogoutUri = "https://localhost:7275/signout-oidc",
    PostLogoutRedirectUris = { "https://localhost:7275/signout-callback-oidc" },

    AllowOfflineAccess = true,
    AllowedScopes = {
        IdentityServerConstants.StandardScopes.OpenId,
        IdentityServerConstants.StandardScopes.Profile,
        IdentityServerConstants.StandardScopes.Email,
        JwtClaimTypes.Role
    },
}

Currently my config in Blazor Web App like this :

builder.Services.AddAuthentication
    (options =>
    {
        options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
        options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
    }).AddCookie(CookieAuthenticationDefaults.AuthenticationScheme)
      .AddOpenIdConnect(OpenIdConnectDefaults.AuthenticationScheme, options =>
      {
          options.RequireHttpsMetadata = false;
          options.Authority = "https://localhost:5445/";

          options.ClientId = "sitantewebapp";
          options.ClientSecret = "sitantewebappsecret";
          options.ResponseType = OpenIdConnectResponseType.Code;

          options.Scope.Add("openid");
          options.Scope.Add("profile");
          options.Scope.Add("role");

          options.SaveTokens = true;
          
          options.GetClaimsFromUserInfoEndpoint = true;

          options.CallbackPath = "/signin-oidc";
          options.SignOutScheme = OpenIdConnectDefaults.AuthenticationScheme;
          options.SignedOutCallbackPath = "/signout-oidc-callback";
      });		
Someone is typing...

Post a Reply

You must be logged in to add a new post.
Number of online users: 2
An error has occurred. This application may no longer respond until reloaded. Reload 🗙