IdentityModel / oidc-client-js

OpenID Connect (OIDC) and OAuth2 protocol support for browser-based JavaScript applications
Apache License 2.0
2.43k stars 840 forks source link

SignoutRedirect not redirecting #1337

Closed ps1Xt closed 3 years ago

ps1Xt commented 3 years ago
import { UserManager, WebStorageStateStore } from 'oidc-client';
const config = {
  userStore: new WebStorageStateStore({ store: window.localStorage }),
  authority: 'http://localhost:65018',
  client_id: 'xxxxxxxxxxReactId',
  response_type: 'code',
  redirect_uri: "http://localhost:3000",
  scope: 'openid',
  post_logout_redirect_uri: "http://localhost:3000/Logout",
};

function App() {
  let userManager = new UserManager(config);
  const signIn = () => {
    userManager.signinRedirect()
  }
  const logOut = (e : any) => {
    userManager.signoutRedirect()
  }

BackEnd side

new List<Client>
            {
                new Client
                {
                    ClientId = "xxxxxxxxxxReactId",
                    ClientSecrets = {new Secret("xxxxxxxxxxSecret123".ToSha256())},
                    AllowedGrantTypes = GrantTypes.Code,
                    AllowedScopes = {"openid", "xxxxxxxxxxApi" },
                    RedirectUris = { "http://localhost:3000" },
                    PostLogoutRedirectUris = { "http://localhost:3000/Logout" },
                    AllowedCorsOrigins = { "http://localhost:3000" },
                    RequirePkce = true,
                    RequireClientSecret = false,
                    AllowAccessTokensViaBrowser = true,
                    RequireConsent = false,
                    AccessTokenLifetime = 1,
                }
            };

image

with signinRedirect everything works fine but with signOut there are some problems. I need logoutId but query string is empty,