Aller au contenu

Quickstart

Ce contenu n’est pas encore disponible dans votre langue.

Four steps from zero to a signed-in user. The whole thing should take about ten minutes.

Sign up at the Kiavi management dashboard and create an organization. The org is the billing and team-membership boundary, apps live inside it.

Add an application in the dashboard. Pick a slug (used in the auth server URL like yourapp.kiavi.eu), configure allowed redirect URLs, and choose which identity providers to enable.

For mobile apps, register a separate client ending in -native (for example yourapp-native). The native SDK derives its deep-link redirect URI from this suffix.

Pick the SDK that matches where your code runs. Each one ships its own complete reference , this page only shows the minimum.

Web (React, Vue, Svelte, plain JS):

Terminal window
pnpm add @kiavi/kiavi-browser

React Native (Expo or bare RN):

Terminal window
pnpm add @kiavi/kiavi-react-native expo-auth-session expo-secure-store expo-crypto

Server (Node, Bun, Deno, edge runtimes):

Terminal window
pnpm add @kiavi/kiavi-js

The SDKs all follow the same shape: construct one client, ensure a session at app entry, attach the access token to outgoing API calls.

import { KiaviClient } from '@kiavi/kiavi-browser'
export const auth = new KiaviClient('https://auth.your-domain.com')
// At app entry / route guard:
const session = await auth.authenticate()
// On every API call:
const token = await auth.getAccessToken()
fetch('/api/things', { headers: { Authorization: `Bearer ${token}` } })
import { KiaviClient } from '@kiavi/kiavi-react-native'
export const kiavi = new KiaviClient({
authBaseUrl: 'https://auth.your-domain.com',
clientId: 'yourapp-native',
})
// From a sign-in button:
await kiavi.authenticate()
// On every API call:
const token = await kiavi.getAccessToken()
fetch('https://api.yourapp.com/me', {
headers: { Authorization: `Bearer ${token}` },
})
import { KiaviClient } from '@kiavi/kiavi-js'
const kiavi = new KiaviClient('https://auth.your-domain.com', 'my-api-audience')
// In your request handler:
const token = request.headers.get('authorization')?.replace(/^Bearer /i, '') ?? ''
const user = await kiavi.verifyToken(token)
if (!user) return new Response('Unauthorized', { status: 401 })