Skip to Content
HomeLink Hub
Calendar

Get the Google Calendar consent URL

GET
/api/v1/calendar/google/url

Access: Bearer token required.

Returns the Google OAuth consent URL the client should open in the browser to connect the user's calendar. The URL requests only the https://www.googleapis.com/auth/calendar.events scope with offline access and forced consent, and embeds a signed state token (valid for 10 minutes) carrying the user id and the return path. After consent Google redirects the browser to GET /calendar/google/callback, which finishes the connection. returnPath must be an in-app path matching /app or /app/... (letters, digits, _, -, ., /); anything else is silently replaced by /app/inspections.

Authorization

bearerAuth
headerAuthorizationBearer <JWT>

Access token returned by sign-in. Send it as Authorization: Bearer <token>.

Query Parameters

returnPath?string

In-app path to land on after the flow, e.g. /app/inspections. Must start with /app; otherwise /app/inspections is used.

Default"/app/inspections"

Response Body

Consent URL generated.

application/json
  1. response
status*integer
success*boolean
message*string
data*
Example Request
curl -X GET 'http://localhost:4000/api/v1/calendar/google/url'
Example Response
{  "status": 200,  "success": true,  "message": "Google Calendar authorization URL generated",  "data": {    "authUrl": "https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar.events&state=<signed-state>&response_type=code&client_id=<client-id>&redirect_uri=<redirect-uri>"  }}