Google Calendar OAuth callback
Access: Public, no token needed. Also requires: A valid signed state from GET /calendar/google/url.
Redirect target that Google sends the browser to after the consent screen; clients never call it directly. It takes no bearer token: the user is identified by the signed state query parameter issued by GET /calendar/google/url (a JWT signed with a dedicated server-side secret, valid for 10 minutes).
On success the handler exchanges code for tokens, stores the refresh token encrypted (AES-256-GCM) on the user, back-fills Google Calendar events for the user's paid, upcoming, not-yet-synced inspections in the background, and answers with a 302 redirect to <FRONTEND_URL><returnPath>?calendar=connected. It redirects with ?calendar=error instead when code is absent (the user declined), Google returns no refresh token, the calendar scope was not granted, or the token exchange fails. A JSON error is returned only when state is unusable or the feature is not configured.
code?stringAuthorization code appended by Google. Absent when the user declined consent.
state*stringSigned state token from the consent URL; identifies the user and the return path.
Always a redirect when state is valid; there is no JSON body. Location is <FRONTEND_URL><returnPath>?calendar=connected on success or ...?calendar=error on any Google-side failure, where FRONTEND_URL is the web app origin configured on the server and returnPath defaults to /app/inspections.
curl -X GET 'http://localhost:4000/api/v1/calendar/google/callback?state=string'Get the Google Calendar consent URL GET
Returns the Google OAuth consent URL the client should open in the browser to connect the user's calendar.
Disconnect Google Calendar DELETE
Disconnects the authenticated user's Google Calendar: the stored refresh token is revoked at Google on a best-effort basis (a failed revoke is only logged) and then removed from...
HomeLink Hub