Skip to main content
Version: 5.7.0

DetachUniversalIdentity

Detach the universal identity from the current profile

Error Handling Example

public void FailureCallback(int statusCode, int reasonCode, string statusMessage, object cbObject) {
switch (reasonCode) {
case ReasonCodes.DOWNGRADING_TO_ANONYMOUS_ERROR: { // User is detaching their last idenitity
// To proceed, contiuneAsAnonymous must be set to true
_bc.IdentityService.DetachUniversalIdentity(userId, true);

break;
}
case ReasonCodes.MISSING_IDENTITY_ERROR: { // User attempted to detach an identity that doesn't exist
/**
* Need to provide the correct information of an attached identity
*/
break;
}
case ReasonCodes.MISSING_IDENTITY_ERROR: { // User attempted to detach an identity that doesn't belong to them
/**
* Need to provide the correct identity
*/
break;
}
default: { // Uncaught reasonCode
/**
* Log the unexpected reasonCode to your own internal logs,
* to implement needed error handling later
*/
break;
}
}
}
ServiceOperation
identityDETACH

Method Parameters

ParameterDescription
userIdThe player's user ID
continueAnonProceed even if the profile will revert to anonymous?

Usage

http://localhost:3000
string userId = "someId";

_bc.IdentityService.DetachUniversalIdentity(
userId,
true,
SuccessCallback, FailureCallback);
JSON Response
{
"status": 200,
"data": null
}
Common Error Code

Status Codes

CodeNameDescription
40210DOWNGRADING_TO_ANONYMOUS_ERROROccurs when detaching the last non-anonymous identity from an account with continueAnon set to false.
40206MISSING_IDENTITY_ERRORA "profileId" was supplied in the authentication request submitted with new credentials. In other words the credentials record was not found in the brainCloud database. The solution would be to provide known credentials or not supply a "profileId" if the user is actually new.
40209SECURITY_ERRORReturned if a security exception was encountered.