Authentication
Dropbox
Sign in with Dropbox using OAuth 2.0.
Setup
Get credentials
Go to the Dropbox App Console and create an app. Under OAuth 2, add your redirect URI:
https://your-app.com/api/kavach/auth/oauth/callback/dropboxConfigure
import { createKavach } from 'kavachos';
import { oauth } from 'kavachos/auth';
import { dropboxProvider } from 'kavachos/auth';
const kavach = await createKavach({
database: { provider: 'sqlite', url: 'kavach.db' },
plugins: [
oauth({
providers: [
dropboxProvider(
process.env.DROPBOX_CLIENT_ID!,
process.env.DROPBOX_CLIENT_SECRET!,
),
],
}),
],
});DROPBOX_CLIENT_ID=...
DROPBOX_CLIENT_SECRET=...Scopes
Default scopes: account_info.read
| Scope | What it unlocks |
|---|---|
account_info.read | Read the user's account info |
files.metadata.read | List file metadata |
files.content.read | Read file contents |
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /auth/oauth/authorize/dropbox | Redirect to Dropbox |
| GET | /auth/oauth/callback/dropbox | Handle callback |