@oneuid/login
v0.1.4
Published
Drop-in login component for OneUID — email/password, OAuth (Google, GitHub, Apple), and phone OTP
Readme
@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
# or
pnpm add @oneuid/login
# or
yarn add @oneuid/loginPeer 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
| Prop | Type | Required | Description |
|------|------|----------|-------------|
| 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. |
| env | 'dev' \| 'stage' \| 'prod' | No | Used when sending forgot-password email via the app’s env provider. |
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). Email/password includes a Forgot password? link that calls POST /v1/auth/forgot-password.
Important links
- OneUID (marketing, get started) — https://oneuid.dev
- API reference (all endpoints) — https://oneuid.dev/docs
- Dashboard — https://dashboard.oneuid.dev
- API base URL — https://api.oneuid.dev
- Postman — Download the collection from the dashboard; it matches the API docs.
License
MIT
