@@ -17,9 +17,12 @@ When users authenticate via the headless OAuth flow:
1717| Endpoint | Method | Description |
1818| ----------| --------| -------------|
1919| ` /health ` | GET | Health check, returns ` {"status": "ok"} ` |
20- | ` /callback ` | GET | OAuth callback, exchanges code for token |
20+ | ` /callback ` | GET | Google OAuth callback, exchanges code for token |
2121| ` /token/{state} ` | GET | Retrieve token (consumes it) |
2222| ` /status/{state} ` | GET | Check token status without consuming |
23+ | ` /m365/sessions ` | POST | Create a one-click Microsoft 365 read-only login session |
24+ | ` /m365/start/{state} ` | GET | Redirect user to Microsoft authorize URL |
25+ | ` /m365/callback ` | GET | Microsoft OAuth callback with PKCE/email validation |
2326
2427### Response Codes
2528
@@ -51,7 +54,12 @@ When users authenticate via the headless OAuth flow:
5154| ----------| -------------|
5255| ` WK_CLIENT_ID ` | OAuth client ID |
5356| ` WK_CLIENT_SECRET ` | OAuth client secret |
54- | ` WK_REDIRECT_URL ` | OAuth redirect URL |
57+ | ` WK_REDIRECT_URL ` | Google OAuth redirect URL |
58+ | ` WK_PUBLIC_BASE_URL ` | Public HTTPS base URL for the deployed auth server; M365 derives ` /m365/callback ` from this |
59+ | ` WK_CALLBACK_SERVER ` | Backward-compatible public base URL fallback |
60+ | ` WK_M365_CLIENT_ID ` | Microsoft Entra application/client ID for M365 broker |
61+ | ` WK_M365_TENANT_ID ` | Microsoft tenant ID; defaults to ` organizations ` |
62+ | ` WK_M365_BROKER_TOKEN ` | Required bearer token for trusted callers creating ` /m365/sessions ` |
5563
5664Command-line flags take precedence over environment variables.
5765
@@ -68,14 +76,17 @@ go build -o auth-server .
6876### Docker Build
6977
7078``` bash
71- docker build -t auth-server .
79+ docker build -t workit- auth-server .
7280docker run -p 8080:8080 \
73- -e WK_CLIENT_ID=" your-client-id" \
74- -e WK_CLIENT_SECRET=" your-client-secret" \
75- -e WK_REDIRECT_URL=" https://auth.example.com/callback" \
76- auth-server
81+ -e WK_PUBLIC_BASE_URL=" https://auth.hv.example" \
82+ -e WK_M365_CLIENT_ID=" <hapvida-entra-app-client-id>" \
83+ -e WK_M365_TENANT_ID=" <hapvida-tenant-id>" \
84+ -e WK_M365_BROKER_TOKEN=" <strong-random-admin-token>" \
85+ workit-auth-server
7786```
7887
88+ For Google relay compatibility, also set ` WK_CLIENT_ID ` , ` WK_CLIENT_SECRET ` , and optionally ` WK_REDIRECT_URL ` .
89+
7990## Deployment
8091
8192### Docker Compose Example
@@ -92,13 +103,10 @@ services:
92103 - WK_CLIENT_SECRET=${WK_CLIENT_SECRET}
93104 - WK_REDIRECT_URL=https://auth.example.com/callback
94105 restart : unless-stopped
95- healthcheck :
96- test : ["CMD", "wget", "--spider", "-q", "http://localhost:8080/health"]
97- interval : 30s
98- timeout : 3s
99- retries : 3
100106` ` `
101107
108+ The runtime image is distroless and has no shell utilities such as ` wget`; configure Kubernetes/OCI HTTP probes against `/health` instead of a container-local shell healthcheck.
109+
102110# ## Reverse Proxy (nginx)
103111
104112` ` ` nginx
0 commit comments