Skip to content

Google

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 minimal display_name or scopes; 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 a GoogleCredentials DB 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

Operational notes

  • oauth_states are ephemeral in-memory by default — use Redis/DB for durable state across instances. When refresh fails with invalid_grant, mark the credential as needing reauth and notify operators.