Browse docs

@kolaylogin/expo

Expo + React Native client. React Native has no cookie jar so we persist the session JWT in expo-secure-store(iOS Keychain / Android Keystore) and attach it as Authorization: Bearer.

Copy this quickstart guide as a prompt for LLMs to implement KolayLogin in your application.

Install

npm install @kolaylogin/expo expo-secure-store

Set up the client

src/auth.ts
import * as SecureStore from 'expo-secure-store';
import { KolayLoginExpoClient } from '@kolaylogin/expo';

// baseUrl defaults to https://api.kolaylogin.com (the hosted SaaS).
// RN apps don't share a cookie jar
// with a web origin, so we hit the API directly with bearer auth.
export const kolay = new KolayLoginExpoClient({
  secureStore: SecureStore,
});

Sign in

const onSubmit = async (email: string, password: string) => {
  const claims = await kolay.signInEmailPassword(email, password);
  if (!claims) throw new Error('invalid_credentials');
};

Attach to your own API calls

const headers = await kolay.authHeader();
const res = await fetch('https://api.yourapp.com/me', { headers });

OAuth via deep link

  • Register yourapp://oauth-callback in the dashboard.
  • Open the provider URL with expo-auth-session or WebBrowser.
  • On the callback deep link, call kolay.ingestDeepLink(url) — it pulls the jwt query param and stores it securely.
Server must return the JWT in the body
Opt native clients into the bearer-token model by sending the x-kl-client: native header. The API then returns { jwt } in the sign-in response body instead of relying on cookies.