@oneuid/login

Drop-in login component for OneUID. Renders the right UI from your app’s enabled auth methods: email/password, OAuth (Google, GitHub, Apple), and phone OTP.
Install
npm install @oneuid/login
pnpm add @oneuid/login
yarn add @oneuid/login
Peer dependencies: React 18+ (and react-dom).
Usage
import { LoginBox } from '@oneuid/login';
<LoginBox
clientId="clxx..."
apiUrl="https://api.oneuid.dev"
onSuccess={(data) => {
console.log(data.accessToken, data.refreshToken);
// Store tokens and redirect or update app state
}}
onError={(msg) => console.error(msg)}
/>
Props
clientId | string | Yes | Your OneUID app client ID (from the dashboard). |
apiUrl | string | Yes | OneUID API base URL (e.g. https://api.oneuid.dev). |
onSuccess | (data: LoginSuccessData) => void | Yes | Called with { accessToken, refreshToken, expiresIn, user } after a successful login. |
onError | (error: string) => void | No | Called when loading auth methods or login fails. |
redirectUrl | string | No | OAuth callback URL (defaults to current window location). |
className | string | No | Extra CSS class for the container. |
brandName | string | No | App name shown in the title (otherwise from API). |
logoUrl | string | No | URL of your logo image. |
The component fetches enabled auth methods from GET /v1/public/auth-methods?clientId=... and shows the matching options (social buttons, email/password form, or phone OTP flow).
Important links
License
MIT