Guides
Getting started

Authentication

Exchange clientId and clientSecret for a 300-second Bearer JWT and send it on every call.

GO 2.0 uses OAuth2 client credentials. You exchange the clientId and clientSecret for a JWT and send that token in the Authorization header of every business call. There is no hash, HMAC or body signature.

Get the token

The body is camelCase JSON; the response follows the Keycloak format, in snake_case.

bash
curl --request POST \
  --url https://pay4fun.mimicr.dev/auth \
  --header 'Content-Type: application/json' \
  --data '{
    "clientId": "<client_id>",
    "clientSecret": "<client_secret>"
  }'
json
{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIi...",
  "expires_in": 300,
  "refresh_expires_in": 0,
  "refresh_token": null,
  "token_type": "Bearer",
  "not-before-policy": 0,
  "session_state": null,
  "scope": "payment-gateway"
}
StatusWhen
200Token issued
401Invalid clientId or clientSecret. The body is empty
502Authentication service unavailable: {"title": "Authentication service unavailable", "status": 502}

Reference: Get a token.

Use the token

bash
curl --url https://pay4fun.mimicr.dev/profile/api/v1 \
  --header 'Authorization: Bearer <token>'

Calls without a token, or with an expired or invalid one, get 401 with an empty body before they reach the service.

Renewal

The token lasts expires_in seconds (300). The client credentials flow has no refresh: request a new token before it expires, for example when 30 seconds are left. Keep the token in memory and reuse it across calls instead of requesting one per request.

To test expiry without waiting 5 minutes, move the sandbox clock forward: npx mimicr clock pay4fun +5m. The token issued before starts answering 401.

Credentials

  • Keep them in your backend only; never in the app or the browser.
  • In Mimicr, read them from GET https://api.mimicr.dev/v1/pay4fun (credentials.client_id and credentials.client_secret) or in the console.
  • Reset credentials generates a new clientSecret at once. The previous one stops working on /auth. At Pay4Fun the new secret goes by e-mail; in Mimicr it shows up in the console and the control API. In Mimicr, tokens already issued stay valid until they expire.

JWT details in Mimicr

The token is an RS256 JWT signed with your sandbox's key, with a Keycloak-style header ({"alg":"RS256","typ" : "JWT","kid" : ...}) and the claims exp, iat, jti, iss, sub, azp and scope: "payment-gateway". Don't depend on those claims: treat the token as opaque.