Today we're launching OAuth apps, available to every Context.dev workspace.
An OAuth app lets someone use their own Context.dev account inside your product. They approve a request on Context.dev, and your product gets a scoped token instead of their API key. You can use that token to call the API on their credits, to sign them in, or both.
Until now, if you built on Context.dev you had one option: put your own API key on your server and pay for every call your users make. That works well for a lot of products. But we kept hearing from teams building agents, CLIs, and developer tools whose users already have Context.dev accounts. They didn't want to resell credits, and they really didn't want to ask users to paste an API key into a settings field. Now they don't have to.
Pick how your product uses Context.dev
| You want | Use | Who pays |
|---|---|---|
| Your product calls Context.dev and you cover the cost | An API key on your server | Your workspace |
| Each user brings their own account to your web product | An OAuth server app | The user's workspace |
| The same, from a CLI, desktop, or mobile app | An OAuth public app with PKCE | The user's workspace |
| People log in to your product with their Context.dev account | An OAuth app with the profile scope | Nobody. Sign-in uses no credits |
| Log people in and call the API on their credits | An OAuth app with profile plus API scopes | The user's workspace |
These modes combine. A common setup runs your product's free tier on your own key and lets heavier users connect their own account.
How it works
- Register an app on the OAuth apps dashboard. You get a client ID (
ctxt_app_...), plus a client secret (ctxt_cs_...) if the app has a backend. Owners and admins can create and manage apps. - Send the user to Context.dev. They sign in or create an account, see exactly what your app is asking for, pick the workspace that pays, and approve.
- Exchange the code. Context.dev redirects back with a code, and your product trades it for an access token and a refresh token.
- Call the API. The access token works anywhere an API key does, including our SDKs, limited to the scopes the user approved.
Here's the exchange for a server app. It's standard OAuth 2.0 with PKCE (S256 is required for every app):
curl -X POST https://www.context.dev/oauth2/token \
-d grant_type=authorization_code \
-d client_id=$CONTEXT_CLIENT_ID \
-d client_secret=$CONTEXT_CLIENT_SECRET \
-d code=$CODE \
-d code_verifier=$CODE_VERIFIER \
-d redirect_uri=https://yourapp.com/callback/contextThen use the access token exactly like an API key:
import ContextDev from 'context.dev';
const client = new ContextDev({ apiKey: accessToken });
const page = await client.web.scrape({
url: 'https://example.com',
formats: { markdown: true },
});Access tokens (ctxt_oat_...) last an hour. Refresh tokens (ctxt_ort_...) rotate on every use and stay valid for 30 days from their last use, so an active connection never has to ask the user again. Authorization server metadata is published at /.well-known/oauth-authorization-server for libraries that discover it.
Scopes you can ask for
Ask only for what your product needs. The consent screen spells out each scope in plain language.
data:execute: scrape, search, and enrichment. This is the default.logs:read: usage and request logs.monitors:readandmonitors:write: read or manage Monitors, including their webhooks.batches:readandbatches:write: read or submit and cancel batches.access_policies:readandaccess_policies:write: read or manage access policies.profile: the user's account ID, verified email, and name. No API access.
Sign in with Context.dev
Request profile and the token response includes a user object with a stable id, a verified email, and a name. If your product's users are developers, they likely already have a Context.dev account, so this is a one-click sign-in. Sign-in on its own uses no credits. Add data:execute or any other API scope to the same request and you get identity and API access in one consent.
CLIs, desktop, and mobile apps
Apps that can't keep a secret register as "CLI, desktop, or mobile" and rely on PKCE alone. CLIs and desktop apps use a loopback redirect like http://127.0.0.1/callback, which matches on any port. Mobile apps use an HTTPS universal link or app link. Each device gets its own tokens, so signing in on a new laptop doesn't sign anyone out elsewhere.
Users stay in control
- Consent is explicit. The consent screen lists every requested scope and names the workspace that pays.
- Tokens do only what was approved. Asking for different scopes creates a separate connection with its own consent.
- One click to disconnect. The Connected apps page lists every connection with its scopes. Disconnecting ends every token the app holds for it, immediately.
- No saved browser profiles. OAuth apps can't list or use a workspace's saved browser profiles, so logged-in sessions never leave the workspace.
New apps show a notice on the consent screen until we verify them. To get your app verified, email support@context.dev.
Get started
Create your first app on the OAuth apps dashboard, then follow the guide that fits:
- Connect a user's account from your backend
- CLI, desktop, and mobile apps
- Sign in with Context.dev
- Reference for endpoints, scopes, token lifetimes, and errors
If you're building something on top of this, we'd love to see it. Tell us about it.
- Yahia Bakour, Founder of Context.dev