3

I can't get the PostLogoutRedirectUri from IdentityServer4 because logoutId on my Logout action is always null. I checked and the PostLogoutRedirectUris property has the same exact url I'm sending and it still won't work, logoutId is always null.

After researching a little bit deeper I found out one of the errors being thrown are due to IsActiveContext not being active:

I just couldn't find the process to fix it and confirm if this is the only problem.

Logs:

enter image description here

Code:

enter image description here

ClientStore:

var client = new Client
{
    ClientId = application.Key,
    ClientName = application.Description,
    AllowedGrantTypes = grantType,
    AllowedScopes = new List<string>
    {
        IdentityServerConstants.StandardScopes.OpenId,
        IdentityServerConstants.StandardScopes.Profile,
        IdentityServerConstants.StandardScopes.Email,
        IdentityServerConstants.StandardScopes.OfflineAccess,
        "role",
        "openIdConnectClient"
    },
    AllowOfflineAccess = true,
    AllowAccessTokensViaBrowser = true,
    RedirectUris = new List<string> { application.Url },
    PostLogoutRedirectUris = new List<string> { $"{application.Url}" },
    RequireConsent = false,
    ClientSecrets = new List<Secret> { new Secret(application.Key.Sha256()) }
};

Request:

enter image description here

I've read a lot of related questions such as, but not limited to:

eestein
  • 4,914
  • 8
  • 54
  • 93
  • Is it present with the correct `ClientId` in the `ClientPostLogoutRedirectUris` table? – Wim Ombelets Dec 14 '18 at 12:48
  • @WimOmbelets hi, do you mean Client.PostLogoutRedirectUris? If so, yes, it is there. I'm going to update my question with code from ClientStore. – eestein Dec 14 '18 at 13:00
  • @WimOmbelets updated. – eestein Dec 14 '18 at 13:02
  • @eestein I had exactly the same problem and managed to solve it by setting SaveToken true in the options of my resource api. `services.AddAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme) .AddIdentityServerAuthentication(options => { options.Authority = Configuration.GetValue("AuthConfig:AuthorityEndpoint"); options.ApiName = "someapi"; options.RequireHttpsMetadata = true; options.SaveToken = true; });` – Daan May 29 '19 at 07:15
  • 2
    I had exactly the same issue and in my case the root cause was the extra slash at the end of the `postLogoutRedirectUri` in the IDM config, while in the request to `/connect/endsession` the `postLogoutRedirectUri` was without the slash. – managerger Aug 01 '19 at 08:41

0 Answers0