oidc-client-ts
oidc-client-ts copied to clipboard
How to use UserManager with HashRouter in React?
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!



Have you checked in the settings: response_mode
: "query" vs "fragment"
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

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)
No routes matched location
i guess that is routing problem of your own application. You need to ensure that this can be handled...
see solution i found and put in https://github.com/authts/oidc-client-ts/issues/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