Skip to content

When the provider is incorrect,useAutoSignin keeps reloading the page indefinitely #1706

@Ennoriel

Description

@Ennoriel

When the provider is incorrect,useAutoSignin keeps reloading the page indefinitely.

I have an application where the authority / client_id changes and may be undefined. In this case, the http call to the well-known fails but I guess it shouldn't reload the page. I've tried multiple options, without any change:

monitorSession: false,
checkSessionIntervalInSeconds: 10,
silentRequestTimeoutInSeconds: 10,
stopCheckSessionOnError: true,

I have made a reproduction repo: https://github.com/Ennoriel/repro-big-react-oidc-provider

// App.tsx
import { useAutoSignin } from "react-oidc-context";

function App() {
  // If you provide no signinMethod at all, the default is signinRedirect
  const { isLoading, isAuthenticated, error } = useAutoSignin({
    signinMethod: "signinRedirect",
  });

  if (isLoading) {
    return <div>Signing you in/out...</div>;
  }

  if (!isAuthenticated) {
    return <div>Unable to log in</div>;
  }

  if (error) {
    return <div>An error occured</div>;
  }

  return <div>Signed in successfully</div>;
}

export default App;
// main.tsx
import { AuthProvider } from "react-oidc-context";
import App from "./App";
import { createRoot } from "react-dom/client";

const oidcConfig = {
  authority: "https://this-does-not-exist.xwgfsf",
  client_id: "this_dose_not_exist",
  redirect_uri: window.origin,
};

createRoot(document.getElementById("root")!).render(
  <AuthProvider {...oidcConfig}>
    <App />
  </AuthProvider>
);

Did I do something that I shouldn't have?

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