AxaFrance / oidc-client

Light, Secure, Pure Javascript OIDC (Open ID Connect) Client. We provide also a REACT wrapper (compatible NextJS, etc.).
MIT License
570 stars 152 forks source link

Failed to normalize url after redirect from auth provider #1392

Open HSULGIT opened 6 days ago

HSULGIT commented 6 days ago

Issue and Steps to Reproduce

OidcServiceWorker.js:19 Failed to normalize url: undefined
normalizeUrl @ OidcServiceWorker.js:19
getCurrentDatabasesTokenEndpoint @ OidcServiceWorker.js:291
handleFetch @ OidcServiceWorker.js:367

When user gets redirected to keycloak login and put in credentials and hit login, the redirect to the next page (react-oidc secured component) causes the error seen above. Seems that i tries to inintialize the auth but the OidcTrustedDomains config is not loaded in time for the OidcServiceWorker. Only happens after login on auth provider. When reloading website no error occurs.

Also i got a non Error in console on that:

TypeError: Failed to fetch
    at ke (:3000/static/js/bundle.js:136546:34)
    at r (:3000/static/js/bundle.js:136623:41)
    at Object.startKeepAliveServiceWorker (:3000/static/js/bundle.js:136658:42)
    at :3000/static/js/bundle.js:137325:178
    at async n (:3000/static/js/bundle.js:137803:19)
    at async ks (:3000/static/js/bundle.js:137633:9)

After that also the fetching of "/.well-known/openid-configuration" from auth provider which is present and available, fails. When following the url there is the openid-configuration present.

Also the fetch on "https://myDomain.de/OidcKeepAliveServiceWorker.json?minSleepSeconds=150" fails, like mentioned here (no OidcKeepAliveServiceWorker.json is present in public folder): https://github.com/AxaFrance/oidc-client/pull/1355

What could lead to this problems?

Versions

7.13.6

Additional Details

  "dependencies": {
    "@axa-fr/react-oidc": "^7.13.6",
    "@date-io/date-fns": "^1.3.13",
    "@emotion/react": "^11.11.0",
    "@emotion/styled": "^11.11.0",
    "@fontsource/roboto": "^5.0.2",
    "@mui/icons-material": "^5.11.16",
    "@mui/material": "^5.13.3",
    "@mui/styled-engine-sc": "^5.12.0",
    "@mui/system": "^5.14.0",
    "@mui/x-date-pickers": "^7.3.2",
    "@tag0/use-text-width": "^1.2.0",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "axios": "^1.6.7",
    "dayjs": "^1.11.11",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-dropzone": "^14.2.3",
    "react-measure": "^2.5.2",
    "react-papaparse": "^4.1.0",
    "react-router-dom": "^6.4.5",
    "react-scripts": "^5.0.1",
    "react-virtualized": "^9.22.5",
    "react-virtualized-auto-sizer": "^1.0.24",
    "react-window": "^1.8.10",
    "react-window-infinite-loader": "^1.0.9",
    "styled-components": "^5.3.11",
    "typescript": "^4.9.5",
    "uuid": "^9.0.0",
    "web-vitals": "^2.1.4"
  },
    "devDependencies": {
    "@types/react-measure": "^2.0.12",
    "@types/react-virtualized": "^9.21.30",
    "@types/react-window": "^1.8.8",
    "@types/styled-components": "^5.1.34",
    "@types/uuid": "^9.0.2",
    "css-loader": "^6.8.1",
    "env-cmd": "^10.1.0",
    "husky": "^7.0.4",
    "openapi-typescript-codegen": "^0.25.0",
    "style-loader": "^3.3.3"
  }
guillaume-chervet commented 3 days ago

Hi @HSULGIT thank you for your issue.

Do you have a sample of your configuration and also you trusted domain.js?