Skip to main content
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 token instead of their API key. You can use that to sign them in, to call the API on their credits, or both.

Choose how to integrate

You can combine them. A common setup uses your own API key for the free tier of your product, and lets heavier users connect their own account.

How an OAuth app works

1

You register an app

You get a client ID, and a client secret if the app has a backend.
2

Your product sends the user to Context.dev

They sign in or create an account, see what your app is asking for, pick a workspace, and approve.
3

Context.dev sends them back with a code

Your product exchanges the code for an access token and a refresh token.
4

Your product uses the token

The access token works wherever an API key does, limited to the scopes the user approved. If you asked for profile, the response also says who the user is.
Your product never sees the user’s API key, and the user can disconnect your app at any time.

Register an app

Create an app on the OAuth apps page. Owners and admins can create and change apps. You get a client ID that starts with ctxt_app_. A server app also gets a client secret that starts with ctxt_cs_. The secret is shown once, so store it in your server-side secret store. You can rotate it from the app’s menu. The name can’t include Context.dev. Until your app is verified, the consent screen warns users that Context.dev can’t vouch for it and shows where the connection is delivered. To verify an app, contact us. Verification covers the app’s name and redirect domains, so renaming the app or adding a redirect domain removes it. Apps that receive the code on the user’s device always show a caution, because any program on that device could be asking.

What the user controls

  • Consent. The consent screen lists every scope you request, in plain language, and names the workspace that pays.
  • Exactly what they approved. A token can do what its consent screen listed and nothing more. Approving the same request again reuses the existing connection. Asking for different scopes creates a separate one.
  • Disconnect. The Connected apps page lists each connection with its scopes and a Disconnect button. Disconnecting ends every token your app holds for that connection.

Next steps

Connect a user's account

Call the API from your backend on the user’s credits.

CLI, desktop, and mobile apps

Connect from an app that cannot keep a secret.

Sign in with Context.dev

Log people in to your product, with or without API access.

Reference

Endpoints, parameters, scopes, token lifetimes, and errors.