Skip to content

Authentication

Endpoints for exchanging credentials for short-lived Bearer tokens. See the "OAuth Tokens" guide for the full integration walkthrough.

Issue or refresh an access token

Request

Exchanges credentials for a short-lived Bearer access token and a single-use refresh token. See the "OAuth Tokens" guide for the full integration walkthrough, lifecycle diagram, and the serialisation guidelines that keep partners from tripping the refresh-reuse detector.

Two grant types are supported:

  • client_credentials — bootstrap exchange: trade your long-lived API key (sent as client_secret) for the first token pair.
  • refresh_token — rotate: exchange a current refresh token for a new pair. The old refresh token is marked single-use and may not be presented again.

This endpoint does NOT require an existing Bearer or X-Authorization header — the request body carries its own credentials.

Bodyrequired
grant_typestringrequired

OAuth 2.0 grant type.

Enum:"client_credentials""refresh_token"
client_secretstring

The long-lived API key — required when grant_type=client_credentials.

Example:"a1b2c3d4e5..."
client_idstring

Optional and ignored. Accepted for compatibility with OAuth client libraries that always send it.

refresh_tokenstring

A current (single-use, unrotated) refresh token — required when grant_type=refresh_token.

Example:"bmg_rt_..."
curl -i -X POST \
  https://docs.bemyguest.com.sg/_mock/openapi/v2/oauth/token \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode grant_type=client_credentials \
  --data-urlencode client_secret=a1b2c3d4e5... \
  --data-urlencode client_id=string \
  --data-urlencode refresh_token=bmg_rt_...

Responses

A fresh access + refresh token pair.

Headers
Cache-Controlstring
Example:"no-store"
Pragmastring
Example:"no-cache"
Bodyapplication/json
token_typestringrequired

Always Bearer.

Value:"Bearer"
access_tokenstringrequired

Short-lived bearer token. Send as Authorization: Bearer <token> on subsequent API requests.

Example:"bmg_at_f1e2d3c4..."
refresh_tokenstringrequired

Single-use refresh token. Exchange via grant_type=refresh_token before the access token expires.

Example:"bmg_rt_a1b2c3d4..."
expires_inintegerrequired

Seconds until the access token expires. Current default is 900 (15 min).

Example:900
Response
{ "token_type": "Bearer", "access_token": "bmg_at_f1e2d3c4...", "refresh_token": "bmg_rt_a1b2c3d4...", "expires_in": 900 }