Add PBandGraphOauth scaffold and auth UI

This commit is contained in:
2025-12-19 05:42:29 +00:00
commit b51963f5d7
6264 changed files with 606430 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
# 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.