Skip to main content

OIDC

vercel.oidc retrieves and decodes Vercel OIDC tokens.

Async Token Lookup

from vercel.oidc import decode_oidc_payload
from vercel.headers import set_headers
from vercel.oidc.aio import get_vercel_oidc_token


async def main() -> None:
    token = await get_vercel_oidc_token()
    payload = decode_oidc_payload(token)
    project_id = payload.get("project_id")

Token lookup prefers the x-vercel-oidc-token request header registered with vercel.headers.set_headers(), then VERCEL_OIDC_TOKEN. The compatibility alias vercel.oidc.set_headers() updates the same header context. In local development, you can load a short-lived token dynamically:

VERCEL_OIDC_TOKEN=$(vc project token some-project) some-command

Use vercel.oidc.get_vercel_oidc_token() for synchronous code.

Verification

Requires the verify extra, which adds pyjwt[crypto]:

pip install "vercel-oidc[verify]"
from vercel.oidc import extract_bearer_token, verify_vercel_oidc_token

claims = verify_vercel_oidc_token(extract_bearer_token(request.headers))

Verification allows only RS256, resolves the signing key by kid from Vercel's JWKS, and pins the issuer to Vercel's OIDC service, which mints both https://oidc.vercel.com and the team-scoped https://oidc.vercel.com/<team>. It fails closed: when the expected project or environment cannot be resolved from the arguments, VERCEL_PROJECT_ID, or VERCEL_TARGET_ENV/VERCEL_ENV, every token is rejected. vercel.oidc.aio.verify_vercel_oidc_token() is the async twin.

Token Identity

A token is a signature over an identity plus an expiry, so one identity is issued many tokens over time. To key client-side state on the identity rather than on the token, use:

from vercel.oidc import resolve_vercel_oidc_token_identity

identity = resolve_vercel_oidc_token_identity(token)  # stable across a refresh

The token is verified first — signature, issuer and expiry — and only then are its identity claims reduced to an opaque digest that carries no credential and is safe to log.

What it does not do is authorize: it returns no claims and does not check the project, environment, owner or audience. Use verify_vercel_oidc_token() for that.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vercel_oidc-0.8.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vercel_oidc-0.8.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file vercel_oidc-0.8.0.tar.gz.

File metadata

  • Download URL: vercel_oidc-0.8.0.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for vercel_oidc-0.8.0.tar.gz
Algorithm Hash digest
SHA256 dbcb1e19697c87f89ae25c5bfeb8018fdb3904d9d92290796cc290ae7eeef61e
MD5 baf38a0afd72ea12c851b3cf730007fe
BLAKE2b-256 34c5fa8c0c298f86e9e144fb012b3f6d45490e9af240dd6d3319cd2e2441002b

See more details on using hashes here.

File details

Details for the file vercel_oidc-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: vercel_oidc-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for vercel_oidc-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb8bb715f20edf5539554951d0374b4956550688c8a8b7ccb69f8275ff464e22
MD5 c604593595c672460ac10bed8418ba55
BLAKE2b-256 1ad6c380d2d171840a67883a30f453b2edb3adabab3b5519941b445c312135c6

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page