From 5be170cf16d1e4ce68d92780a545c964bff9990c Mon Sep 17 00:00:00 2001 From: Head of Product & Engineering Date: Mon, 6 Apr 2026 11:25:11 +0200 Subject: [PATCH] fix: strip client ID suffix when passing appId to /oauth/installedLocations GHL_CLIENT_ID has the format "<24-hex-objectid>-" but the installedLocations endpoint expects only the 24-hex MongoDB ObjectId portion as appId. Strip everything from the first "-" onward. Co-Authored-By: Paperclip --- internal/ghl/oauth.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/ghl/oauth.go b/internal/ghl/oauth.go index e5b6054..003e684 100644 --- a/internal/ghl/oauth.go +++ b/internal/ghl/oauth.go @@ -293,9 +293,11 @@ func (h *OAuthHandler) getCompanyLocations(ctx context.Context, companyAccessTok if err != nil { return nil, err } + // appId expects the 24-hex MongoDB ObjectId portion of the client ID (before any "-" suffix). + appID := strings.SplitN(h.clientID, "-", 2)[0] q := req.URL.Query() q.Set("companyId", companyID) - q.Set("appId", h.clientID) + q.Set("appId", appID) q.Set("isInstalled", "true") req.URL.RawQuery = q.Encode() req.Header.Set("Authorization", "Bearer "+companyAccessToken)