Skip to main content
Version: 5.7.0

AuthenticateSettopHandoff

Authenticate the user with a custom Set-top Handoff Code - which is an short, easy-to-enter code suitable for use in devices with limited data entry capabilities (i.e. Set-top boxes, VR headsets, etc.) The hand-off code can be generated via the CreateSettopHandoffCode cloud-code call.

caution

Make sure you've initialized the brainCloud library before authenticating.

ServiceOperation
authenticationV2AUTHENTICATE

Method Parameters

ParameterDescription
handoffCodeThe set-top hand-off code generated via CreateSettopHandoffCode

Usage

http://localhost:3000
string handoffCode = "handoffCode";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};

_bc.AuthenticationService.AuthenticateSettopHandoff(
handoffCode, successCallback, failureCallback);
JSON Response
{
"status": 200,
"data": {
"abTestingId": 48,
"lastLogin": 1572446599748,
"server_time": 1572446599779,
"refundCount": 0,
"timeZoneOffset": -5,
"experiencePoints": 0,
"maxBundleMsgs": 12,
"createdAt": 1572446599168,
"parentProfileId": null,
"emailAddress": null,
"experienceLevel": 0,
"handoffJson": {"key": "value"},
"countryCode": "CA",
"vcClaimed": 0,
"currency": {
"test": {
"consumed": 0,
"balance": 0,
"purchased": 0,
"awarded": 0
},
"credits": {
"consumed": 0,
"balance": 0,
"purchased": 0,
"awarded": 0
}
},
"id": "5e04aa28-4c1f-45c2-b32c-3f52c59cfb49",
"compressIfLarger": 0,
"amountSpent": 0,
"previousLogin": 1572446599171,
"playerName": "",
"pictureUrl": null,
"incoming_events": [],
"sessionId": "b9rr6j32ragmhnp5aajbi8vn82",
"languageCode": "en",
"vcPurchased": 0,
"isTester": false,
"summaryFriendData": null,
"loginCount": 2,
"xpCapped": false,
"profileId": "5e04aa28-4c1f-45c2-b32c-3f52c59cfb49",
"newUser": "false",
"playerSessionExpiry": 60,
"sent_events": [],
"maxKillCount": 11,
"rewards": {
"rewardDetails": {},
"currency": {},
"rewards": {}
},
"statistics": {
"wins": 0,
"gamesLost": 0,
"stat2": 0,
"gamesPlayed": 0,
"TestStat": 0,
"highestScore": 0,
"currency": 0,
"losses": 0,
"TestStat2": 0,
"gamesWon": 0
}
}
}
Common Error Code

Status Codes

CodeNameDescription
40206MISSING_IDENTITY_ERRORThe identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [but un-associated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
40207SWITCHING_PROFILESIndicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the provided profileId. This may indicate that the user wants to switch accounts in the app. Most often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
40208MISSING_PROFILE_ERRORReturned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
40217UNKNOWN_AUTH_ERRORAn unknown error has occurred during authentication.
40307TOKEN_DOES_NOT_MATCH_USERThe user's password is incorrect.