kavachOS
Authentication

Coinbase

Sign in with Coinbase using OAuth 2.0.

Get credentials

Create an OAuth application

Go to Coinbase Developer Platform and create a new OAuth2 application.

Set the Redirect URI to:

https://your-app.com/api/kavach/auth/oauth/callback/coinbase

Copy your credentials

After creating the app, copy the Client ID and Client Secret from the application settings.

Configuration

lib/kavach.ts
import { createKavach } from 'kavachos';
import { oauth, coinbaseProvider } from 'kavachos/auth';

const kavach = await createKavach({
  database: { provider: 'postgres', url: process.env.DATABASE_URL! },
  secret: process.env.KAVACH_SECRET!,
  baseUrl: 'https://your-app.com',
  plugins: [
    oauth({
      providers: [
        coinbaseProvider(
          process.env.COINBASE_CLIENT_ID!,
          process.env.COINBASE_CLIENT_SECRET!,
        ),
      ],
    }),
  ],
});
COINBASE_CLIENT_ID=...
COINBASE_CLIENT_SECRET=...

Scopes

Default scope: wallet:user:read, wallet:user:email

ScopeWhat it unlocks
wallet:user:readRead user profile and account info
wallet:user:emailRead user's email address
wallet:accounts:readRead wallet account balances

Coinbase scopes use a namespaced format (wallet:resource:action). Request only the scopes your app needs. Users see the full permission list during authorization.

Endpoints

MethodPathDescription
GET/auth/oauth/authorize/coinbaseRedirect to Coinbase
GET/auth/oauth/callback/coinbaseHandle callback

On this page