Token VaultDocs
Credentials

Connect with your own OAuth app

Connect Google, GitHub, Spotify or a custom provider with an OAuth app you register yourself, so the provider sends the sign-in result to your webhook and no code or token passes through Token Vault.

Token Vault never holds your credentials, so it cannot be the OAuth client that receives a provider's authorization code. You register your own OAuth app at the provider, and your webhook finishes the sign-in. (The one exception to "no credential path" on the platform is the legacy tv-refresh path, for tokens from Token Vault's old built-in OAuth apps: Token refresh.)

Your webhook must advertise the oauth-callback capability. If it does not, the page says "Your webhook does not support connecting with your own OAuth app yet. Update it to the latest version." See Update your webhook.

The older Connect buttons that used Token Vault's own OAuth app are off. They return 410 OAUTH_CONNECT_DISABLED: "Connecting through Token Vault's own OAuth app is turned off, because it put your tokens in Token Vault." Use this page, or paste the token as type JWT with its refresh token.

Set it up

Pick the provider

Open Credentials, then Add credential. In What, choose Google (OAuth), GitHub (OAuth) or Spotify (OAuth). In Value, switch from Paste a value to Connect your OAuth app. The panel is titled "Connect with your own OAuth app".

Register an app at the provider

Create an OAuth app there. Set its redirect URI to the one the panel shows:

https://<your-webhook>/v1/oauth/callback

Enter the client id and scopes

Paste the Client id into the panel. Token Vault stores only the client id and the scopes. Saving or changing either asks you to sign in again.

The Scopes field is filled with the scopes in force: what you saved before, or the provider's default. Edit it as a space-separated list. Changing the client id never resets your scopes. Leave the default and it keeps following the default.

  • Google needs explicit API scopes, such as https://www.googleapis.com/auth/gmail.readonly, https://www.googleapis.com/auth/drive.readonly or https://www.googleapis.com/auth/calendar. The default (openid email profile) only identifies the account, so a token with it cannot read mail or files.
  • GitHub defaults to repo read:user.
  • Spotify defaults to user-read-email. Add what you use, for example playlist-read-private user-library-read.

Put the secret on your webhook

The client secret goes on your webhook, never into Token Vault. On the reference Cloudflare Worker, add it to the OAUTH_PROVIDERS_JSON secret:

{ "google": { "clientId": "your-client-id", "clientSecret": "your-client-secret" } }
echo '{"google":{"clientId":"...","clientSecret":"..."}}' | npx wrangler secret put OAUTH_PROVIDERS_JSON --name <your-worker-name>

For a custom provider the entry also needs its authorizeUrl and tokenUrl. The panel's snippet includes them.

Name it and connect

Under Store as, type the service name. Press Connect <Provider>. You go to your webhook, then to the provider to approve, then back to the Add flow, which resumes and finishes the save.

GitHub stores as Plain text. Google and Spotify store as OAuth (access + refresh). Labels, MCP servers and access are set on the same page as for any credential. The page keeps only names and choices in your browser's session storage across the round trip.

Custom providers

Pick Custom... in the provider row to use a provider that is not built in (any OAuth 2.0 authorization-code provider). Fill in:

FieldRule
Provider key2 to 32 lower-case letters, digits, - or _, starting with a letter. Not google, github, spotify, custom, pending, list, tv, tokenvault or oauth
Authorize URLhttps, a public host name, no user name or password
Token URLThe same rules
Scopes, Client idAs above

All of it is non-secret and stored with your account. You can define up to 10; Remove forgets one (stored credentials and the secret on your webhook are untouched). Token Vault checks the URLs for shape only and never calls them. Your webhook builds the authorize URL and picks the token URL and the client secret from its own entry for the key:

{ "acme": { "clientId": "...", "clientSecret": "...", "authorizeUrl": "https://auth.example.com/authorize", "tokenUrl": "https://auth.example.com/token" } }

The webhook sends the secret only to the token URL in that entry, and refuses a connect whose ticket names a different one. A custom provider needs a webhook on spec 2.7.0 or later (oauth-callback); failure reporting needs 2.8.0.

What just happened

Loading diagram...
HopSees the code or tokens?Carries
Token VaultNoProvider name, service name, the state ticket it signed
Your webhookYesAuthorization code, your client secret, the tokens
Back to Token VaultNostatus, service, provider and a short error code on failure

Token Vault makes no outbound call during this flow. The webhook sends your client secret only to the provider's own token endpoint, so Token Vault cannot point it elsewhere.

Refresh

The webhook refreshes these tokens on its own timer, using the same client secret, and also when a token is fetched close to expiry. Refresh now on the credential page sends /v1/refresh-notify (reason manual_request). Token Vault never refreshes them for you.

If a refresh fails, the credential page says why. If your webhook has no OAuth client for the provider, Refresh now answers "not refreshed: your webhook has no OAuth client for this provider; add it to OAUTH_PROVIDERS_JSON". When a provider revokes the grant, the credential shows Reconnect needed, your inbox gets a message with a Reconnect button, and Reconnect opens this panel for that credential. Details: Token refresh.

From the CLI

  • The CLI cannot run the connect step. The page shows "OAuth connect runs in the browser."

For the endpoints see OAuth apps API and the OAuth callback spec.

Ready to try it?

Sign in with Google or email. Your credentials stay on your own webhook, and the quickstart gets Claude Code making its first MCP tool call in about 15 minutes.

On this page