1.2 KiB
1.2 KiB
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/healthand/api/submitexample (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
cd PBandGraphScaffold
bun install
bun run dev
Open http://localhost:5500 and click "Login with Microsoft".
Notes
- Graph token helper
getGraphToken()is inserver.ts; call it when you add Graph API routes. /api/submitcurrently writes the posted payload toPB_COLLECTIONafter validatingpbToken; adjust fields as needed.- Static file is served from
index.htmlin this folder.