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

Okta redirection issue with React HashRouter #110

Open
infa-mseelam opened this issue Apr 12, 2021 · 3 comments
Open

Okta redirection issue with React HashRouter #110

infa-mseelam opened this issue Apr 12, 2021 · 3 comments

Comments

@infa-mseelam
Copy link

My App is using HashRouters now I want to integrate OKTA Authentication but that issue is Okta does not allow to add # in the redirection URL. As a result after successful login, I am landing on a 404 unknown pages. I don't want to use change to Browser routers

Could anybody suggest to me how to deal with #Routes with OKta redirection..?

If possible can you please provide an example?

@denysoblohin-okta
Copy link
Contributor

Thanks for submitting this issue.

Internal ref: OKTA-386208

@denysoblohin-okta
Copy link
Contributor

denysoblohin-okta commented Apr 12, 2021

As a workaround, you can use window.location.origin as redirect URI
and add

    oktaAuth.handleLoginRedirect();

in useEffect of your home page component

@denysoblohin-okta
Copy link
Contributor

denysoblohin-okta commented Apr 12, 2021

As example, you can use samples-js-react

With some changes:

const REDIRECT_URI = `${window.location.origin}/login/callback`;
import { HashRouter as Router, Route, Switch } from 'react-router-dom';
    oktaAuth.handleLoginRedirect();

@denysoblohin-okta denysoblohin-okta linked a pull request Feb 21, 2024 that will close this issue
14 tasks
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

Successfully merging a pull request may close this issue.

2 participants