Get started
Connect your application to a Legation environment.
Who this is for: developers adding customer sign-in to a web or mobile app. What you get: a configured Legation client your app can use to sign users in.
Availability
Environment set-up and the @legation/client package are available at release. Until then, this page describes the integration so you can plan for it.
Before you write code
Your application needs a Legation environment and its endpoint, and its redirect URLs must be registered exactly. See Origins and redirect URLs.
Add the client package
Add @legation/client to your project. Installation instructions are published at release. The package is ESM only.
Create the client
import { createAuthClient } from "@legation/client/client";
export const authClient = createAuthClient({
baseURL: "https://dev-<environment-id>.<region>.<your-id0n-domain>", // example: use your environment endpoint
});baseURL is your environment's endpoint. The address shown is an example of its form, not a real address.
Use it
Continue with Basic usage.
There is no server setup
You do not create a Legation server instance, connect a database, run migrations or mount a request handler. id0n runs all of that.
The hosted Legation environment signs users in and holds their Legation session. Any session or user state your application keeps is yours to manage. See Legation's session and your application's session.
Common failures
| Error | Cause |
|---|---|
INVALID_ORIGIN or MISSING_OR_NULL_ORIGIN | Your app's origin is not registered for the environment. |
| Network errors | baseURL does not match the endpoint id0n gave you. |