Keylio

References

Keylio API reference documentation

Core

Keylio

The main class for initializing the authentication system.

import { Keylio } from "keylio";

const keylio = new Keylio(config);

Parameters

Prop

Type

Client (React)

React hooks and providers for client-side session management.

import { KeylioSessionProvider, useSession } from "keylio/react";

KeylioSessionProvider

Context provider that must wrap your application to enable session management.

Prop

Type

useSession

Hook to access the current session state and authentication methods.

Prop

Type

Server (Next.js)

Utilities for integrating Keylio with Next.js.

import { KeylioNextHandler } from "keylio/next";

KeylioNextHandler

Creates the API route handlers for Next.js App Router.

export const { GET, POST } = KeylioNextHandler(keylio);

Adapters

Database adapters for persisting sessions.

Prisma Adapter

import { prismaAdapter } from "keylio/adapters/prisma";

MongoDB Adapter

import { mongodbAdapter } from "keylio/adapters/mongodb";

Types

Common TypeScript definitions used throughout the library.

import type { KeylioAuthConfig } from "keylio/types";

KeylioAuthConfig

The primary configuration object for initializing Keylio.

Prop

Type

SessionOptions

Prop

Type

AuthConfig

Prop

Type

Callbacks

Prop

Type

OptionalFeatures

Prop

Type

On this page