Skip to main content

GetAuthToken

Mints a user token — scoped to one specific user — used by FetchRewardInfo and GetAllScratchCardsByUserId.

Available
POST /api/GetAuthToken
EnvironmentURL
Productionhttps://rewardscenter.cheggout.com/api/GetAuthToken
UAThttps://rewardscenter-uat.cheggout.com/api/GetAuthToken

Authentication — Signed envelope

Host discrepancy

The web widget documentation publishes GetAuthToken on a different host family. If you are integrating the JavaScript widget, confirm which host applies to your channel during onboarding. TBD — tracked in Open Items.

Request​

Standard signed envelope — CHANNELID, SIGN, BDATA.

BDATA payload​

FieldTypeRequiredDescription
virtualIdstringYesThe user this token will represent
channelNamestringYesYour channel name
The key is channelName here

getSecuredReferenceToken reads bName for the same concept. These payloads are matched case-sensitively — using the wrong key silently omits the value.

Payload before encoding
{
"virtualId": "pub_8f14e45fceea167a",
"channelName": "YOURCHANNEL"
}

Example​

curl -X POST https://rewardscenter-uat.cheggout.com/api/GetAuthToken \
-H "Content-Type: application/json" \
-d '{
"CHANNELID": "YOURCHANNEL",
"SIGN": "REPLACE_WITH_YOUR_BASE64_SIGNATURE",
"BDATA": "REPLACE_WITH_BASE64_PAYLOAD"
}'

Response​

Signed envelope — CHANNELID: "CHEGGOUT", SIGN, BDATA.

Decoded BDATA​

FieldTypeDescription
tokenstringThe user token. Use as Authorization: Bearer <token>.
expireDatestringExpiry indication
Decoded BDATA
{
"token": "REPLACE_WITH_USER_TOKEN",
"expireDate": "REPLACE_WITH_EXPIRY"
}

The token is passed as the bearer credential for reward reveal and other user-detail APIs.

Lifetime​

Widget documentation states a one-hour validity, with re-minting done from your server.

TBD Exact lifetimes are configured per channel, and expireDate has no documented format or time zone. Do not parse it — refresh reactively on an authentication failure, or proactively when a user session starts. See Tokens.

Errors​

ResponseMeaningWhat to do
{"STATUS":"FAILURE","ERRORSTRING":"Signature Mismatch!"}Signature could not be verifiedCheck you signed the Base64 BDATA string and that CHANNELID is right
{"STATUS":"FAILURE","ERRORSTRING":"Internal Error!"}Platform-side failureRetry with backoff

Failure bodies carry no SIGN — check for this shape before verifying.

TBD No error catalogue distinguishes an unknown virtualId, a malformed payload or an unwhitelisted IP.

When to mint​

Guidance:

  • Mint at session start, not at the moment of the tap, so the reveal is a single round trip.
  • Cache per user — one token serves all of that user's calls until it expires.
  • Single-flight the refresh so concurrent requests for the same user mint once.
  • Never mint from the client. Minting requires your private key.

Reference token vs user token​

Reference tokenUser token
Minted bygetSecuredReferenceTokenGetAuthToken
ScopeYour channelOne user
Payload keybNamechannelName
RefreshHourly, scheduledPer user, on session start
Accepted byGetRewardFetchRewardInfo, GetAllScratchCardsByUserId
Safe on a clientNoOnly where the surface requires it

Next​