Skip to content

Blank Page after Redirect from IDP #1622

Description

@MariusDanner

Hey all,
we have the weird issue that sometimes after being redirected to the IDP (Keycloak in our case), we get stuck on a URL that looks like this: http://localhost:3000/?state=abc&session_state=def&iss=https://idp.com/realms/test&code=code At this point, we just see a blank page. Normally, we get redirected to http://localhost:3000/dashboard.
When directly accessing http://localhost:3000/?state=abc&session_state=def&iss=https://idp.com/realms/test&code=code, we also see the blank and don't get redirected. Is there a way to force a redirect to the dashboard?

Our application looks like this:

// main.tsx
const oidcConfig = {
  authority: AUTHORITY,
  client_id: CLIENT_ID,
  redirect_uri: REDIRECT_URI,
  onSigninCallback: (): void => {
    const previousPage = sessionStorage.getItem('pp');
    if (previousPage) {
      sessionStorage.removeItem('pp');
      window.location.replace(previousPage);
    } else {
      window.history.replaceState({}, document.title, window.location.pathname);
    }
  },
};

ReactDOM.createRoot(document.getElementById('root')!).render(
  <AuthProvider {...oidcConfig}>
    <TokenExpirationHandler>
      <App />
    </TokenExpirationHandler>
  </AuthProvider>,
);

// App.tsx
const App = withAuthenticationRequired(..., {
  onBeforeSignin: () => {
    sessionStorage.setItem(
      'pp',
      window.location.pathname + window.location.search + window.location.hash,
    );
  },
});
export default App;

Thanks already! And thanks for the great project :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions