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.
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
- pnpm
- Yarn
- Bun
npm install @lumoauth/react
pnpm add @lumoauth/react
yarn add @lumoauth/react
bun add @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
| Prop | Type | Description |
|---|---|---|
afterSignInUrl | string | Where to go when sign-in is complete. Defaults to the afterSignInUrl of the provider. |
loading | ReactNode | What to show while the code is exchanged. |
error | ReactNode | (error: string) => ReactNode | What to show when the exchange fails. A function receives the reason. |