Authentication
Peak Gateway uses several credentials at distinct trust boundaries. Do not substitute one credential type for another.
OAuth 2.0 client credentials
Server-to-server integrations authenticate with an OAuth client ID and secret, then use the returned short-lived access token:
curl -sS -X POST "https://api.peakgateway.co/auth/oauth2/token" \
-u "${PEAK_CLIENT_ID}:${PEAK_CLIENT_SECRET}" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "grant_type=client_credentials" \
--data-urlencode "scope=hosted-payments:write"
Send the token on API requests:
Authorization: Bearer <ACCESS_TOKEN>
The token's scopes must cover the operation. Request only scopes assigned to the client; the token endpoint does not grant scopes the client does not own.
API-key exchange
A Gateway API key is a long-lived credential used only to obtain a short-lived OAuth access token:
curl -sS -X POST "https://api.peakgateway.co/auth/oauth2/api-key/token" \
-H "X-Api-Key: ${PEAK_API_KEY}"
Do not send the raw API key to ordinary resource endpoints.
Checkout session tokens
Shopper-facing payment requests use the token associated with a checkout session. A session token authorizes only that checkout flow. It is not an OAuth client credential and does not grant management access.
Portal and internal identities
- The merchant and admin portals use Firebase-backed user authentication plus organization, location, and role authorization.
- Private service-to-service endpoints use Google Cloud Run IAM identity.
These boundaries are not public API authentication alternatives. Public integrations should use OAuth access tokens, SDK-managed OAuth, or checkout session tokens as documented for the operation.
Token handling
- Keep OAuth client secrets and API keys in a server-side secret manager.
- Cache access tokens only until their reported expiration and refresh before use when necessary.
- Never log credentials, bearer tokens, session tokens, or full payment data.
- Provision separate credentials for staging and production.
- Rotate or revoke a compromised client or API key immediately.
- Treat
401as missing, expired, or invalid authentication; treat403as an authenticated caller that lacks the required scope or resource authority.