Docs/Authentication/Authentication

Authentication

Platform keys, participant tokens, and how to authenticate SDK and API calls safely.

All AdQuest API calls from the SDK use the public platform key. Balance, lottery entry, and claims also require a participant token.

Headers

HeaderWho sets itPurpose
X-AdQuest-Platform-KeyClient SDKIdentifies the platform
X-AdQuest-Participant-TokenClient SDKAuthorizes the end user
X-AdQuest-Platform-SecretHost backend onlyMints sessions and privileged ops
X-AdQuest-Preview-TokenTheme studio previewOptional preview branding

Minting participant sessions

POST /api/v1/platform/participant-sessions
X-AdQuest-Platform-Secret: YOUR_PLATFORM_SECRET
Content-Type: application/json

{
  "external_user_id": "host-user-123",
  "display_name": "Ada"
}

Security tip

Secret API credentials and platform secrets must stay on trusted servers. Never bundle them inside Android, iOS, Unity, or client JavaScript.

Refreshing tokens

When the SDK fires onAuthRequired or the API returns a session error, mint a new token and update the client:

  • React: remount or pass a new participantToken
  • Embed: adquest:setParticipantToken

Preview mode

Theme Studio mints a preview token so designers can see unpublished theme JSON. Preview tokens are for branding only — still pair them with a participant session for interactive flows.