Skip to main content

getSecuredReferenceToken

Mints the reference token — a channel-scoped credential used as the bearer for GetReward.

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

AuthenticationSigned envelope

Call this from a scheduled job, not per request

The reference token identifies your channel, not a user, so one token serves all of your traffic. Refresh it hourly from a background job on your backend and cache the result. Minting one per user request adds latency for no benefit.

Request

Standard signed envelope:

FieldTypeRequiredDescription
CHANNELIDstringYesYour channel identifier, issued by Cheggout
SIGNstringYesBase64 SHA256withRSA signature over the BDATA string
BDATAstringYesBase64 of the payload below

BDATA payload

FieldTypeRequiredDescription
bNamestringYesYour channel name
The key is bName, matched case-sensitively

This endpoint reads bName. GetAuthToken reads channelName for the same concept. Sending the wrong key silently omits the value and produces a token that later fails.

Payload before encoding
{ "bName": "YOURCHANNEL" }

Example

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

Response

Signed envelope from Cheggout:

FieldTypeDescription
CHANNELIDstringAlways "CHEGGOUT"
SIGNstringCheggout's signature — verify with their public key
BDATAstringBase64 of the payload below

Decoded BDATA

FieldTypeDescription
referenceKeystringThe reference token. Use as Authorization: Bearer <referenceKey> on GetReward.
expireDatestringExpiry indication
Response envelope
{
"CHANNELID": "CHEGGOUT",
"SIGN": "REPLACE_WITH_CHEGGOUT_SIGNATURE",
"BDATA": "REPLACE_WITH_BASE64_PAYLOAD"
}
Decoded BDATA
{
"referenceKey": "REPLACE_WITH_TOKEN",
"expireDate": "REPLACE_WITH_EXPIRY"
}

TBD expireDate has no documented format or time zone. Do not parse it as a contract. Refresh on a fixed hourly schedule and re-mint on an authentication failure. 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 correct
{"STATUS":"FAILURE","ERRORSTRING":"Internal Error!"}Platform-side failureRetry with backoff; escalate if persistent
Failure bodies are unsigned

These carry no SIGN. Check for the STATUS/ERRORSTRING shape before attempting signature verification, or your client will throw on a legitimate error response.

TBD No further error catalogue is published for this endpoint — no distinct codes for an unknown channel, an unwhitelisted IP or a malformed payload. Log any unrecognised body with the endpoint name and report it.

Usage pattern

Implementation notes:

  • Refresh with a margin — every 50 minutes for an hourly token — so no user request waits on a mint.
  • Single-flight the refresh so a burst doesn't trigger many concurrent mints.
  • On a 401 from GetReward, force a refresh and retry the original call once.
  • Never send this token to a client. It is channel-wide.

Next