513e975530df124b2715c1f31bf0ad5dd0abc7f3
- Replace popup OAuth with SDK authWithOAuth2 realtime channel (urlCallback) so login works in Edge app mode without navigating the main window - Remove manual redirect/sessionStorage OAuth flow that broke in Edge app mode - Serve PocketBase config (URL, collection, provider) from server endpoint backed by env vars instead of hardcoded localhost - Fix /api/submit: target Notes collection with correct field mapping (body_plain, body_html, title, type, email, Username, userId, job_note, Job_Number) instead of Job_Info_Prod with wrong field names - Remove localhost fallbacks from auth-module backend and frontend
Prism Notes
PocketBase + Microsoft Graph OAuth capture app. Frontend is a Tailwind-powered note and audio capture page; backend is a Bun/Hono server that validates PocketBase tokens and can mint Graph tokens (client credentials flow).
What you get
server.ts— Bun + Hono server with/health,/api/graph/status,/api/submit, and staticindex.htmlserving.index.html— Microsoft OAuth via PocketBase plus note/audio capture UI.tsconfig.json,package.json,bun.lock— project configuration.
Setup
- Install Bun (https://bun.sh).
- Add a
.envfile at the project root with the variables below. - Install deps:
bun install - Run dev server:
bun run --watch server.ts(default port 3030).
Open http://localhost:3030 and sign in with Microsoft.
Environment variables
| Name | Description |
|---|---|
CLIENT_ID |
Azure AD app (client) ID |
CLIENT_SECRET |
Azure AD client secret |
TENANT_ID |
Azure AD tenant ID |
REDIRECT_URI |
Redirect URI configured in the Azure app |
PB_DB |
PocketBase URL (e.g., http://127.0.0.1:8090) |
PB_COLLECTION |
Collection to store submissions (default Job_Info_TestEnv) |
PB_AUTH_COLLECTION |
Auth collection for token refresh (default Users) |
PORT |
Server port (default 3030, enforced in package.json dev script) |
Notes
getGraphToken()inserver.tsis ready for Graph API calls; extend with additional routes as needed./api/submitvalidates the providedpbTokenthen writes the payload toPB_COLLECTION; adjust fields to match your schema.- Static file serving uses
index.htmlfrom the repo root.
OneNote sync (append MVP)
- Backend endpoint:
POST /api/onenote/append - Required headers:
Authorization: Bearer <delegated Microsoft access token>x-pb-token: <PocketBase user token>
- Current hardcoded target in
server.ts:- Host:
czflex.sharepoint.com - Site path:
/sites/Team - Section ID:
ed504699-67be-47a3-838a-e01ec17198fb - Page ID:
addbbca7-18ce-4d8d-833e-96cc08d990bc
- Host:
- Frontend buttons:
- New note:
Submit + Sync OneNote - Note detail:
Sync to OneNote
- New note:
Important: sync requires a delegated Microsoft token with OneNote write permissions. The UI captures this from PocketBase Microsoft OAuth metadata when available.
Description
Languages
HTML
74.1%
TypeScript
18.5%
JavaScript
7.4%