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

How to use UserManager with HashRouter in React? #667

Closed
HanCai98 opened this issue Sep 2, 2022 · 5 comments
Closed

How to use UserManager with HashRouter in React? #667

HanCai98 opened this issue Sep 2, 2022 · 5 comments
Labels
question Further information is requested

Comments

@HanCai98
Copy link

HanCai98 commented Sep 2, 2022

Hi, I am working on a React project, and need to use auth service. Previously, I used BrowserRouter, everything is good. But for some reason, I need to change to use HashRouter, but this time, the login page seems get stuck. Does anyone have any idea? Really appreciate it!

Screen Shot 2022-09-01 at 23 37 25

Screen Shot 2022-09-01 at 23 38 05

Screen Shot 2022-09-01 at 23 38 15

@pamapa
Copy link
Member

pamapa commented Sep 2, 2022

Have you checked in the settings: response_mode: "query" vs "fragment"

@pamapa pamapa added the question Further information is requested label Sep 2, 2022
@HanCai98
Copy link
Author

HanCai98 commented Sep 2, 2022

Hi, @pamapa, thanks for your advice, I try to change my userManager settings (shown as below), but my login page still get stuck, in the browser, I have this error:

react_devtools_backend.js:4026 No routes matched location "code=qamaster_1963BE7834DB682D5011CD4D0C8E53CD21C62AE8166C5B0447FDB2AE722C9ED3&scope=openid%20profile&state=f834eb900d464ae2a9b123ef61297e02&session_state=ayY2RUc4OCX-2X4wUVyH2DVmmZ54BD4kmfMonsvXBGI.r-8Lg6TouvpkKhDfLNrhIQ"  
    at Routes (http://localhost:3000/static/js/bundle.js:59491:5)
    at AuthProvider (http://localhost:3000/main.45a79611680d96b316ae.hot-update.js:66:5)
    at Router (http://localhost:3000/static/js/bundle.js:59424:15)
    at HashRouter (http://localhost:3000/static/js/bundle.js:58267:5)
    at App

Screen Shot 2022-09-02 at 10 06 02

@HanCai98
Copy link
Author

HanCai98 commented Sep 2, 2022

Add when I changed the response_type from code to token, I have an error like this

Uncaught (in promise) Error: Only the Authorization Code flow (with PKCE) is supported
    at OidcClient.createSigninRequest (bundle.js:109124:13)
    at UserManager._signinStart (bundle.js:110438:48)
    at UserManager._signin (bundle.js:110430:36)
    at UserManager.signinPopup (bundle.js:110216:29)

@pamapa
Copy link
Member

pamapa commented Sep 5, 2022

No routes matched location i guess that is routing problem of your own application. You need to ensure that this can be handled...

@frontendplace
Copy link

frontendplace commented Oct 25, 2022

see solution i found and put in #734 then you can keep the default response mode for the sts service which y probably need to be 'query'. sombody else should create a PR for this

@pamapa pamapa closed this as completed Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants