# @vercel/oidc

> Runtime OIDC helpers intended for use with Vercel Functions

Latest version **4.0.0** (published 2026-10-02) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @vercel/oidc
pnpm add @vercel/oidc
yarn add @vercel/oidc
bun add @vercel/oidc
```

## Health

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

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2026-10-02 |
| First published | 2025-07-25 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 20 |
| Dependencies | 3 |
| Unpacked size | 156.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16344 |
| Maintainers | matheuss, matt.straka, vercel-release-bot, zeit-bot |

## Links

- npm: https://www.npmjs.com/package/@vercel/oidc
- Repository: https://github.com/vercel/vercel
- Homepage: https://vercel.com
- Issues: https://github.com/vercel/vercel/issues
- npm.io page: https://npm.io/package/@vercel/oidc

## Dependencies (3)

- [jose](https://npm.io/package/jose.md) ^5.9.6
- [@vercel/cli-exec](https://npm.io/package/@vercel/cli-exec.md) 1.0.1
- [@vercel/cli-config](https://npm.io/package/@vercel/cli-config.md) 0.3.1

## Recent versions

- 4.0.0 (latest) — 2026-10-02
- 3.2.0 (canary) — 2026-02-11
- 3.8.10 — 2026-10-02
- 3.8.9 — 2026-09-22
- 3.8.8 — 2026-09-15
- 3.8.7 — 2026-09-09
- 3.8.6 — 2026-09-08
- 3.8.5 — 2026-08-20
- 3.8.4 — 2026-08-11
- 3.8.3 — 2026-08-10
- 3.8.2 — 2026-08-03
- 3.8.1 — 2026-07-24
- 3.8.0 — 2026-07-01
- 3.7.1 — 2026-06-26
- 3.7.0 — 2026-06-23
- … 20 more at https://npm.io/package/@vercel/oidc/versions

## README

# `@vercel/oidc`

Runtime OIDC helper methods intended to be used with your Vercel Functions

## Usage

### Getting an OIDC Token

```typescript
import { getVercelOidcToken } from '@vercel/oidc';

// Get token using project.json configuration
const token = await getVercelOidcToken();

// Get token with explicit project and team (supports both IDs and slugs)
const token = await getVercelOidcToken({
  project: 'my-project', // or 'prj_abc123'
  team: 'my-team', // or 'team_xyz789'
});

// Get token with expiration buffer (refresh if expires within 5 minutes)
const token = await getVercelOidcToken({
  expirationBufferMs: 5 * 60 * 1000,
});
```

## API

### `getVercelOidcToken(options?)`

Gets the current OIDC token from the request context or environment variable. Will refresh the token if expired in development.

**Options:**

- `project?: string` - Project ID (prj\_\*) or slug
- `team?: string` - Team ID (team\_\*) or slug
- `expirationBufferMs?: number` - Buffer time in ms before expiry to trigger refresh (default: 0)

### `getVercelOidcTokenSync()`

Synchronously gets the current OIDC token without refreshing. Use `getVercelOidcToken()` if you need automatic refresh in development.

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