30 lines
1.2 KiB
Markdown
30 lines
1.2 KiB
Markdown
# PBandGraph Scaffold (PocketBase + Microsoft Graph OAuth)
|
|
|
|
Drop-in starter for the PBandGraphOauth pattern:
|
|
- Frontend: PocketBase OAuth with Microsoft provider, shows user display name (top-right), email (bottom-left), version (bottom-right).
|
|
- Backend: Hono + Bun, validates PocketBase `pbToken`, and ready to obtain Graph tokens via client credentials.
|
|
|
|
## Files
|
|
- `server.ts` — Bun server with `/health` and `/api/submit` example (PocketBase write).
|
|
- `index.html` — Minimal UI for Microsoft login via PocketBase.
|
|
- `.env.example` — Required env vars (copy to `.env`).
|
|
- `package.json`, `tsconfig.json` — Project config.
|
|
|
|
## Env vars (copy `.env.example` to `.env`)
|
|
- Azure AD: `CLIENT_ID`, `CLIENT_SECRET`, `TENANT_ID`, `REDIRECT_URI`
|
|
- PocketBase: `PB_DB`, `PB_COLLECTION`, `PB_AUTH_COLLECTION`
|
|
- Server: `PORT` (default 5500)
|
|
|
|
## Run
|
|
```bash
|
|
cd PBandGraphScaffold
|
|
bun install
|
|
bun run dev
|
|
```
|
|
Open http://localhost:5500 and click "Login with Microsoft".
|
|
|
|
## Notes
|
|
- Graph token helper `getGraphToken()` is in `server.ts`; call it when you add Graph API routes.
|
|
- `/api/submit` currently writes the posted payload to `PB_COLLECTION` after validating `pbToken`; adjust fields as needed.
|
|
- Static file is served from `index.html` in this folder.
|