Quickstart
Vercel Connect is available on all plans and is subject to the Vercel Connect terms
This guide shows you how to create your first connector in Vercel Connect and request a runtime provider token from your code.
- A Vercel account
- Vercel CLI installed (
npm i -g vercel) - Node.js 18 or later
- A Linear workspace you can authorize
Create a new directory and connect it to a Vercel project. Linking the directory to a project is the recommended way to authenticate, because the project handles secure OIDC token authentication for you.
Terminalmkdir my-connect-app && cd my-connect-app pnpm init vercel linkWhen prompted, select an existing project or Create a new project. The project doesn't need any code deployed; it just needs to exist so Vercel can issue OIDC tokens to it.
Once linked, pull your environment variables to get a development OIDC token:
Terminalvercel env pullThis creates a
.env.localfile containingVERCEL_OIDC_TOKEN, which the SDK uses to authenticate calls to Vercel Connect. The token is short-lived; re-runvercel env pullif you see authentication errors. When you deploy to Vercel, token management happens automatically.Create a connector for Linear so your code can mint Linear API tokens on behalf of a user. You can do this from the dashboard or the CLI.
Open Connect in the Vercel dashboard. You'll be prompted to pick a team and project; any connector you create from this page is automatically linked to that project, so you can skip a separate attach step.
Select Create Connector, choose OAuth, and keep Managed selected. Under Server URL, enter
mcp.linear.app, select Continue, and set Connector Name tolinear.Creating the connector from this project page automatically links Production, Preview, and Development. To enable a Custom Environment, create the connector first, then open its Projects section, edit the project link, and select the Custom Environment.
Create the connector. Vercel opens your browser to complete the Linear OAuth flow:
Terminalvercel connect create mcp.linear.app --name linearFor a known service such as
notionorokta, the CLI prompts you for the connection method and any credentials it needs, so you can finish setup without leaving the terminal. Runvercel connect create <service> --helpto see what a service supports.Attach the connector to the currently linked project so it can request tokens:
Terminalvercel connect attach oauth/linearBy default,
attachlinks Production, Preview, and Development. It does not automatically include Custom Environments. Use-e production -e previewto restrict the link, or pass a Custom Environment slug such as-e qa. See thevercel connectreference for the full surface.For provider-level isolation, create a separate connector for each environment, install each connector separately, and request only the provider scopes that environment needs. Environment selection on a project link controls which deployments can request tokens; it does not create separate provider grants.
Install
@vercel/connectalong with the dev dependencies you need to run a TypeScript script locally.Terminalnpm install @vercel/connect dotenv @types/node tsx typescriptTerminalyarn add @vercel/connect dotenv @types/node tsx typescriptTerminalpnpm add @vercel/connect dotenv @types/node tsx typescriptTerminalbun add @vercel/connect dotenv @types/node tsx typescriptdotenvloads.env.localso the SDK can readVERCEL_OIDC_TOKEN. Thetsxpackage is a TypeScript runner, andtypescriptand@types/nodeprovide the compiler and Node.js type definitions.Create a file that requests a Linear token on behalf of a specific user and inspects the response:
index.tsimport { config } from 'dotenv'; config({ path: '.env.local' }); import { getTokenResponse, UserAuthorizationRequiredError, } from '@vercel/connect'; const userId = 'user_demo_123'; async function main() { try { const response = await getTokenResponse('oauth/linear', { subject: { type: 'user', id: userId }, scopes: ['read'], }); console.log(`Got token for ${userId} on ${response.connector.uid}`); console.log(`Expires at: ${new Date(response.expiresAt).toISOString()}`); } catch (error) { if (error instanceof UserAuthorizationRequiredError) { console.log(`User ${userId} has not authorized Linear yet.`); console.log('In a real app, surface the consent URL to the user here.'); return; } throw error; } } main().catch(console.error);This requests a user-subject token: Vercel Connect will mint a Linear token that acts as
user_demo_123, scoped toread. In a real app, replaceuser_demo_123with the id you use to identify the signed-in user in your own database.For service-level operations (a bot account or a tenant-wide admin API), use
subject: { type: 'app' }instead. App-subject tokens skip the user-consent flow entirely, though some providers still require a one-time installation or an administrator grant. For multi-tenant connector types like Slack or GitHub, passinstallationIdto address a specific workspace or organization; otherwise the connector's default installation is used. See Tokens for the full set of scoping options.Completing the consent flow
When you catch
UserAuthorizationRequiredError, callstartAuthorizationto get a consent URL to redirect the user to. After they authorize, Vercel completes the OAuth handshake server-side, and your nextgetTokencall for that user succeeds.consent.tsimport { startAuthorization } from '@vercel/connect'; const { url } = await startAuthorization('oauth/linear', { subject: { type: 'user', id: userId }, scopes: ['read'], }); // In a web app, redirect the user to `url`. console.log(`Send the user to: ${url}`);- Terminal
pnpm tsx index.tsThe first time you run this with a new
userId, you'll see:TerminalUser user_demo_123 has not authorized Linear yet. In a real app, surface the consent URL to the user here.That's because no Linear OAuth grant exists yet for
user_demo_123. In a real app you'd catchUserAuthorizationRequiredError, redirect the user to the connector's consent URL, and retry the request once they authorize. Once the user has consented (try it from the connector's page in the dashboard for this demo), re-run the script and you'll see:TerminalGot token for user_demo_123 on oauth/linear Expires at: 2026-06-03T22:42:00.000ZIf you need the token as a string for use in an
Authorizationheader, usegetTokeninstead ofgetTokenResponse.
- Set up authentication: Linked a directory to a Vercel project and pulled an OIDC token so the SDK can authenticate with Vercel Connect.
- Created a connector: Registered Linear as a Custom OAuth connector under your team and attached it to the project.
- Requested a user-scoped token: Called
getTokenResponsewith ausersubject to mint a short-lived Linear token that acts as a specific user, and handled the first-run consent case withUserAuthorizationRequiredError.
- Concepts: Understand connectors, installations, tokens, project links, triggers, and authentication.
- SDK Reference: Full
getTokenandgetTokenResponseparameter reference. - CLI Reference: The full
vercel connectcommand surface. - Pricing: Token-request pricing.
- Limits: Platform limits and rate limits.
Was this helpful?