Skip to content
Dashboard

Enhancing security of backend connectivity with OpenID Connect

Vercel OpenID Connect support helps you replace long-lived credentials with temporary tokens to reduce risk.

Link to headingThe evolution and utility of OIDC

Link to headingLeveraging OIDC with Vercel for enhanced security

Long-lived credentials increase risk over time, while short-lived tokens are only created as-needed and expire, effectively minimizing associated risks.Long-lived credentials increase risk over time, while short-lived tokens are only created as-needed and expire, effectively minimizing associated risks.
Long-lived credentials increase risk over time, while short-lived tokens are only created as-needed and expire, effectively minimizing associated risks.

Link to headingWhy use OIDC?

Link to headingScenario 1: Using long-lived credentials in environment variables

AWS_ACCESS_KEY_ID=AWSKEYEXAMPLE
AWS_SECRET_ACCESS_KEY=AWSSECRETACCESSKEYEXAMPLE

Without OIDC, credentials are typically hard-coded and stored in environment variables, remaining static and reused until manually rotated.Without OIDC, credentials are typically hard-coded and stored in environment variables, remaining static and reused until manually rotated.
Without OIDC, credentials are typically hard-coded and stored in environment variables, remaining static and reused until manually rotated.

Link to headingScenario 2: Using Vercel as an IdP with OIDC

import { awsCredentialsProvider } from '@vercel/functions/oidc';
import * as s3 from '@aws-sdk/client-s3';
const s3client = new s3.S3Client({
credentials: awsCredentialsProvider({
roleArn: process.env.AWS_ROLE_ARN!,
}),
});

With OIDC, tokens are generated dynamically and have short expiration times, reducing the risk associated with long-lived credentials.With OIDC, tokens are generated dynamically and have short expiration times, reducing the risk associated with long-lived credentials.
With OIDC, tokens are generated dynamically and have short expiration times, reducing the risk associated with long-lived credentials.

Link to headingHow it works under the hood

eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Im1yay00MzAyZWMxYjY3MGY0OGE5OGFkNjFkYWRlNGEyM2JlNyJ9.eyJpc3MiOiI8aHR0cHM6Ly9vaWRjLnZlcmNlbC5jb20-Iiwic3ViIjoib3duZXI6bWFyYy1ncmVlbnN0b2Nrcy1wcm9qZWN0czpwcm9qZWN0Om9pZGMtZGVtbzplbnZpcm9ubWVudDpkZXZlbG9wbWVudCIsInNjb3BlIjoib3duZXI6bWFyYy1ncmVlbnN0b2Nrcy1wcm9qZWN0czpwcm9qZWN0Om9pZGMtZGVtbzplbnZpcm9ubWVudDpkZXZlbG9wbWVudCIsImF1ZCI6IjxodHRwczovL3ZlcmNlbC5jb20vbWFyYy1ncmVlbnN0b2Nrcy1wcm9qZWN0cz4iLCJvd25lcl90eXBlIjoidGVhbSIsIm93bmVyIjoibWFyYy1ncmVlbnN0b2Nrcy1wcm9qZWN0cyIsIm93bmVyX2lkIjoidGVhbV9BMWIyQzNkNEU1RjZnN0g4aTlKMGtMbU4iLCJwcm9qZWN0Ijoib2lkYy1kZW1vIiwicHJvamVjdF9pZCI6InByal9LMkZuVDl5WnhWNkh3UXBMME84UjNzUGRXYzdYIiwiZW52aXJvbm1lbnQiOiJkZXZlbG9wbWVudCIsIm5iZiI6MTcyMzA5ODY5OCwiaWF0IjoxNzIzMDk4Njk4LCJleHAiOjE3MjMxNDE4OTh9.J3XFGWdHdOhnk-nbHKYWz-Aa7fT02RBzTBoGK4zSzeLh_AyMGqGqVknhudedF13sqLKHHvZoo77cryijNAg11V_jyayYsTos7KHuLX9qIjMqlKEC7Fin76z6l3qG6sj-X_JrKTCe_4wpWrIYycK2Tz01XXt2NnWEqfChyQ46n05G0e8WjT3EbL8euxhokQemrNnQLRD1gcsAQ-3_VZZ8CWZ0L5OGFyFT9qaj2cCrm_Pli1uIPpSyyZRzzvM7-X41_w1ajvvoJwSgi8JDqMfRa41Y-ipGFoR-gGAa5cxf1xeXh3W5woz7RexbYPSvrIAcnJUDvofnrdXdbYLjdWM5DQ

{
"iss": "https://oidc.vercel.com",
"sub": "owner:marc-greenstocks-projects:project:oidc-demo:environment:development",
"scope": "owner:marc-greenstocks-projects:project:oidc-demo:environment:development",
"aud": "https://vercel.com/marc-greenstocks-projects",
"owner": "marc-greenstocks-projects",
"owner_id": "team_A1b2C3d4E5F6g7H8i9J0kLmN",
"project": "oidc-demo",
"project_id": "prj_K2FnT9yZxV6HwQpL0O8R3sPdWc7X",
"environment": "development",
"nbf": 1723098698,
"iat": 1723098698,
"exp": 1723141898
}

Link to headingSecuring backend connectivity with Vercel

Ready to deploy?