A sample Next.js app that talks to Linear using Vercel Connect for credentials, and displays your overdue or soon to breach SLA tasks.
Clicking Deploy clones this repo, walks you through creating a Linear connector, and writes its UID into the CONNECTOR env var. After it deploys, open the app and click Authorize Linear to grant access.
When Linear hasn't been authorized yet, the app shows an "Authorize Linear" button. After consent, it renders a small dashboard built from the Linear GraphQL API:
- Due soon / Overdue — open issues due in the next 14 days (works on every workspace).
- SLA at risk — issues that are breached / at high or medium SLA risk. Linear SLAs require the Business plan and per-team configuration, so this panel shows an empty state if SLA isn't set up.
- Assigned to me — your active issues.
- Teams — the teams in your workspace.
Browser ──▶ Next.js (server)
│ getTokenResponse("oauth/linear", { subject:{ type:"user", id }, scopes:["read"] })
▼
Vercel Connect ──▶ Linear OAuth
│ short-lived Linear token
▼
api.linear.app/graphql (Authorization: Bearer <token>)
lib/linear.ts—getLinearConnection()exchanges the deployment's Vercel OIDC token for a Linear token. If the user hasn't authorized, it returnsneeds_auth; the UI then links to/api/linear/authorize.app/api/linear/authorize/route.ts— callsstartAuthorization()and redirects the browser to the hosted consent screen. Vercel completes the OAuth handshake server-side, then redirects back to/?connected=1. There is no app-side callback step — the next token request just works.app/api/linear/disconnect/route.ts—revokeToken()tears down the grant.
No Linear secrets ever live in the app or its environment variables.
Either directly deploy using the 1-click deploy button above, that deploys to your Vercel account, or follow these steps below to get started locally.
Prerequisites: Vercel CLI (npm i -g vercel), Node ≥ 24, and a Linear workspace you can authorize.
-
Link a Vercel project (issues the OIDC token the SDK authenticates with):
vercel link
-
Create the Linear connector (opens a browser to authorize Linear), then attach it to the project:
vercel connect create linear # or: vercel connect create mcp.linear.app --name linear vercel connect list # note the UID it was given vercel connect attach <connector-uid>
The connector UID varies — a managed Linear connector looks like
linear/yellow-house, a Custom OAuth one likeoauth/linear. Whatever yours is, set it asCONNECTORin.env.local(step 3). IfCONNECTORdoesn't match a connector linked to the project, the app shows a "connector not found" hint with the fix. -
Pull env vars (writes
VERCEL_OIDC_TOKENinto.env.local):vercel env pull
The OIDC token is short-lived — re-run
vercel env pullif you see auth errors during local dev. -
Install and run:
pnpm install pnpm dev
Open http://localhost:3000, click Authorize Linear, approve, and you're in.
Copy .env.local.example for reference. Vars:
| Variable | Default | Purpose |
|---|---|---|
CONNECTOR |
oauth/linear |
Vercel Connect connector UID for Linear. |
LINEAR_DEMO_USER_ID |
demo-user |
Subject id for the user-scoped token. See note below. |
VERCEL_OIDC_TOKEN |
(auto) | Added by vercel env pull / injected on Vercel. The SDK uses it to call Vercel Connect. |
Note on the demo user id: this template has no auth system, so it uses a single stable
LINEAR_DEMO_USER_IDas the token subject. That keeps the consent grant persistent across reloads. In a real app, replace it with your signed-in user's id (getSubject()inlib/connect.ts) so each user authorizes Linear for themselves.
Push to a repo and import it on Vercel, or:
vercel deployOn Vercel, the OIDC token is injected automatically — no vercel env pull needed in production. Make sure the connector is attached to the deployed project's environment (vercel connect attach oauth/linear).
- Write data: add scopes (
write,issues:create) inlib/connect.tsand re-authorize, then send GraphQL mutations throughlinearGraphQL(). - More views: the dashboard query in
lib/linear.tsuses aliasedissues(...)lists — add another alias with a different Linear filter (e.g. bycycle,project, orlabel). - Per-user auth: wire
getDemoUserId()to your session.
Built with @vercel/connect. See the Vercel Connect docs and the Linear API docs.