Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect to original url #975

Open
infernalred opened this issue Mar 15, 2023 · 1 comment
Open

Redirect to original url #975

infernalred opened this issue Mar 15, 2023 · 1 comment

Comments

@infernalred
Copy link

Hi. I don't understant how i can return user to original url. Example i open /profile, then in navbar press login -> redirect to identity -> authentificate -> redirect to localhost:3000/signin-oidc? + parameters. Why not redirect to original page /profile? How i can fix it. I can redirect to start page localhost:3000 if i add
onSignIn: async (user: any) => { console.log(user); window.location.replace(window.location.origin); },
My settings:

const oidcConfig = {
  clientId: process.env.REACT_APP_CLIENT_ID!,
  redirectUri: window.location.origin + process.env.REACT_APP_REDIRECT_URI!,
  silentRedirectUri:
     window.location.origin + process.env.REACT_APP_SILENT_REDIRECT_URI!,
  scope: process.env.REACT_APP_SCOPE!,
  authority: process.env.REACT_APP_AUTHORITY!,
  postLogoutRedirectUri: "https://localhost:3000/",
  revokeAccessTokenOnSignout: true,
  automaticSilentRenew: true,
  autoSignIn: false,
  onSignIn: async (user: any) => {
    console.log(user);
    window.location.replace(window.location.origin);
  },
};

<Menu.Item position={"right"} onClick={() => auth.signIn()} name={"Login"} />

Thank you!

@infernalred
Copy link
Author

I think I got it, because onBeforeSignon call only if autoSignIn = true. But how to get state or original url, if i want disable autoSignIn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant