service_omni — Endpoints: Google¶
Location: backend/service_omni/app/api/v1/endpoints/google.py
Summary
- OAuth lifecycle and stored Google credential management (used by Sheets and other Google APIs).
Routes
POST /google/auth— Create an OAuth authorization URL. Body typically accepts minimaldisplay_nameorscopes; response:{ "auth_url": "...", "state": "..." }.
Example:
curl -X POST "http://localhost:8000/api/v1/google/auth" \
-H "Content-Type: application/json" \
-d '{"display_name":"Omni Sheets"}'
-
GET /google/oauth/callback— OAuth callback endpoint (called by Google). Query params:state,code. The endpoint exchanges the code for tokens and persists aGoogleCredentialsDB record. -
GET /google/credentials/— List stored Google credential records. Response model:List[GoogleCredentials]. -
POST /google/credentials/test— Test a stored credential by id (body:{ "credential_id": "..." }) and return connection metadata (spreadsheet access, scopes).
Implementation
- Endpoint implementation: backend/service_omni/app/api/v1/endpoints/google.py
- Google helpers: backend/service_omni/app/services/google.py
Operational notes
oauth_statesare ephemeral in-memory by default — use Redis/DB for durable state across instances. When refresh fails withinvalid_grant, mark the credential as needing reauth and notify operators.