Custom default path name for implicitCallback to redirect to in okta-react

So I have a react single page application and I encountered this possible issue today.

Referring to this: https://github.com/okta/okta-oidc-js/blob/master/packages/okta-react/src/ImplicitCallback.js for the issues. The behavior in question:

const location = JSON.parse(localStorage.getItem(referrerKey) || '{ "pathname": "/" }');

My login page is at ‘/login’ and we don’t have a page defined at ‘/’. Assuming somebody hit the ‘/login’ page directly, there is no ‘secureRouterReferrerPath’ set in localStorage, so the page redirects to ‘/’ which does not exist. So my questions:

  1. Does this need to be handled by us? That would seem a little hacky to me.
  2. Could okta-react define a prop for the ImplicitCallback ‘pathname’ which could default to ‘/’ but gives us a chance to define a custom path name to redirect to by default if referrer path is not set.

Thank you, any guidance is appreciated.

1 Like