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/railwayConfigure
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
| Scope | What it unlocks |
|---|---|
read:profile | Read user profile |
read:email | Read email address |
read:projects | Read project list |
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /auth/oauth/authorize/railway | Redirect to Railway |
| GET | /auth/oauth/callback/railway | Handle callback |