# @logto/client

> [![Version](https://img.shields.io/npm/v/@logto/client)](https://www.npmjs.com/package/@logto/client) [![Build Status](https://github.com/logto-io/js/actions/workflows/main.yml/badge.svg)](https://github.com/logto-io/js/actions/workflows/main.yml) [![Code

Latest version **3.2.2** (published 2026-10-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @logto/client
pnpm add @logto/client
yarn add @logto/client
bun add @logto/client
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.2.2 |
| Published | 2026-10-26 |
| First published | 2022-07-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 4 |
| Unpacked size | 68.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 98 |
| Maintainers | simeng_li, gaosun |

## Links

- npm: https://www.npmjs.com/package/@logto/client
- Repository: https://github.com/logto-io/js
- Homepage: https://github.com/logto-io/js#readme
- Issues: https://github.com/logto-io/js/issues
- npm.io page: https://npm.io/package/@logto/client

## Dependencies (4)

- [jose](https://npm.io/package/jose.md) ^5.2.2
- [@logto/js](https://npm.io/package/@logto/js.md) ^6.1.2
- [camelcase-keys](https://npm.io/package/camelcase-keys.md) ^9.1.3
- [@silverhand/essentials](https://npm.io/package/@silverhand/essentials.md) ^2.9.3

## Recent versions

- 3.2.2 (latest) — 2026-10-26
- 3.2.0-beta.2 (beta) — 2026-09-10
- 3.2.1 — 2026-10-15
- 3.2.0 — 2026-09-30
- 3.2.0-beta.1 — 2026-09-10
- 3.2.0-beta.0 — 2026-09-09
- 3.1.10-beta.0 — 2026-09-08
- 3.1.9 — 2026-09-07
- 3.1.8 — 2026-04-08
- 3.1.7 — 2026-02-24
- 3.1.6 — 2025-12-31
- 3.1.5 — 2025-12-25
- 3.1.4 — 2025-06-20
- 3.1.3 — 2025-05-29
- 3.1.2 — 2025-04-24
- … 55 more at https://npm.io/package/@logto/client/versions

## README

# Logto Client SDK
[![Version](https://img.shields.io/npm/v/@logto/client)](https://www.npmjs.com/package/@logto/client)
[![Build Status](https://github.com/logto-io/js/actions/workflows/main.yml/badge.svg)](https://github.com/logto-io/js/actions/workflows/main.yml)
[![Codecov](https://img.shields.io/codecov/c/github/logto-io/js)](https://app.codecov.io/gh/logto-io/js?branch=master)

The Logto JavaScript Client SDK written in TypeScript.

## Installation

### Using npm

```bash
npm install @logto/client
```

### Using yarn

```bash
yarn add @logto/client
```

### Using pnpm

```bash
pnpm add @logto/client
```

## What is this and how does it work?

Logto JavaScript Client SDK is platformless, and is the foundation of the other platform's SDKs (Browser, Next.js, React, Vue, etc.). Usually you are not expected to use it directly in your application, as we have released a set of official SDKs to help you integrate Logto with your favorite JavaScript frameworks. [Check this out](https://docs.logto.io/docs/recipes/integrate-logto/) and get started!

If Logto does not support your framework and you want to contribute by building a new SDK, we recommend checking out our [Browser SDK](https://github.com/logto-io/js/tree/master/packages/browser) and [Node.js SDK](https://github.com/logto-io/js/tree/master/packages/node) and start from there.

### Adapters

To implement a platform-specific SDK, you should implement the following adapters:

1. storage: save tokens and other info.
2. navigate: handle redirect.
3. generateState: generate state.
4. generateCodeVerifier: generate code verifier.
5. generateCodeChallenge: generate code challenge.
6. cache: optionally cache well-known data.

The client uses the runtime's native `fetch` by default. Set the optional `fetch` adapter only when
the platform needs a custom transport.

The optional `cache` adapter stores well-known data. Cache reads and writes are best-effort and do
not make an otherwise successful request fail. The deprecated `unstable_cache` property remains
supported; `cache` takes precedence when both are provided.

See the [adapters](./src/adapter/index.ts) for more information.

### Request timeouts

Set `requestTimeoutMs` in `LogtoConfig` to apply a timeout to each request to the Logto server. The
option covers discovery, authorization-code and refresh-token exchange, revocation, user info, and
remote JSON Web Key Set requests. Framework SDKs built on `@logto/client` inherit the same option.

```ts
const config = {
  endpoint: 'https://example.logto.app',
  appId: 'your-app-id',
  requestTimeoutMs: 10_000,
};
```

The timeout is opt-in. The client builds its requester on top of native `fetch`, or the adapter's
custom `fetch` transport when provided, so the same timeout policy applies in both cases. A custom
transport must observe `RequestInit.signal` and settle after the signal is aborted. The client
awaits that settlement before it rejects the operation.

The deprecated `requester` adapter remains supported for compatibility. When both `fetch` and
`requester` are provided, `fetch` takes precedence. Since a custom requester is already fully
configured, the client does not apply `requestTimeoutMs` to it.

## Resources

[![Website](https://img.shields.io/badge/website-logto.io-8262F8.svg)](https://logto.io/)
[![Docs](https://img.shields.io/badge/docs-logto.io-green.svg)](https://docs.logto.io/sdk/JavaScript/client/)
[![Discord](https://img.shields.io/discord/965845662535147551?logo=discord&logoColor=ffffff&color=7389D8&cacheSeconds=600)](https://discord.gg/UEPaF3j5e6)

---
_Source: https://npm.io/package/@logto/client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
