kavachOS
Authentication

Railway

Sign in with Railway using OAuth 2.0.

Setup

Get credentials

Go to railway.com and navigate to Account Settings > Developer > OAuth Apps. Create an app and add your redirect URI:

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

Configure

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

const kavach = await createKavach({
  database: { provider: 'sqlite', url: 'kavach.db' },
  plugins: [
    oauth({
      providers: [
        {
          id: 'railway',
          clientId: process.env.RAILWAY_CLIENT_ID!,
          clientSecret: process.env.RAILWAY_CLIENT_SECRET!,
        },
      ],
    }),
  ],
});
RAILWAY_CLIENT_ID=...
RAILWAY_CLIENT_SECRET=...

Scopes

Default scopes: read:profile, read:email

ScopeWhat it unlocks
read:profileRead user profile
read:emailRead email address
read:projectsRead project list

Endpoints

MethodPathDescription
GET/auth/oauth/authorize/railwayRedirect to Railway
GET/auth/oauth/callback/railwayHandle callback

On this page