Skip to main content

Auth callback

The page that the browser returns to after the hosted sign-in. It exchanges the code for tokens and sends the person on.

ComponentReadyView source
Works with
React

This component has no preview: it works only on the address that the hosted sign-in page redirects to, with a code in the query string.

Installation​

npm install @lumoauth/react

Usage​

Render it on the route that you gave the provider as redirectUri.

src/pages/AuthCallback.tsx
import { AuthCallback } from '@lumoauth/react';

export default function AuthCallbackPage() {
return (
<AuthCallback
afterSignInUrl="/dashboard"
loading={<p>Signing you in…</p>}
error={(message) => <p role="alert">Sign-in did not finish: {message}</p>}
/>
);
}

Next.js apps do not need this component. The route handler of @lumoauth/nextjs finishes the sign-in on the server. See the Next.js starter.

Props​

PropTypeDescription
afterSignInUrlstringWhere to go when sign-in is complete. Defaults to the afterSignInUrl of the provider.
loadingReactNodeWhat to show while the code is exchanged.
errorReactNode | (error: string) => ReactNodeWhat to show when the exchange fails. A function receives the reason.