DetachAdvancedIdentity
Detach the identity from this profile.
Service | Operation |
---|---|
identity | DETACH |
Method Parameters
Parameter | Description |
---|---|
authenticationType | Universal, Universal, Facebook, etc |
externalId | User ID |
extraJson | Additional to piggyback along with the call, to be picked up by pre- or post- hooks. Leave empty string for no extraJson |
continueAnon | Proceed even if the profile will revert to anonymous |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
AuthenticationType authenticationType = AuthenticationType.Universal;
string externalId = "externalId";
bool continueAnon = true;
string extraJson = "{\"key\":\"value\"}";
_bc.IdentityService.DetachAdvancedIdentity(
authenticationType,
externalId,
continueAnon,
extraJson,
SuccessCallback, FailureCallback);
AuthenticationType authenticationType = AuthenticationType::Universal;
const char* externalId = "externalId";
bool continueAnon = true;
const char* extraJson = "{\"key\":\"value\"}";
_bc->getIdentityService()->detachAdvancedIdentity(
authenticationType, externalId, continueAnon, extraJson, this);
AuthenticationType authenticationType = [AuthenticationTypeObjc Universal];
NSString * externalId = "externalId";
BOOL continueAnon = true;
NSString * extraJson = "{\"key\":\"value\"}";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc identityService]
detachAdvancedIdentity:authenticationType
externalId:externalId
continueAnon:continueAnon
extraJson:extraJson
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
AuthenticationType authenticationType = AuthenticationType.Universal;
String externalId = "externalId";
boolean continueAnon = true;
String extraJson = "{\"key\":\"value\"}";
this; // implements IServerCallback
_bc.getIdentityService().detachAdvancedIdentity(authenticationType, externalId, continueAnon, extraJson, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var authenticationType = _bc.brainCloudClient.authentication.AUTHENTICATION_TYPE_UNIVERSAL;
var externalId = "externalId";
var continueAnon = true;
var extraJson = {"key":"value"};
_bc.identity.detachAdvancedIdentity(authenticationType, externalId, continueAnon, extraJson, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var authenticationType = AuthenticationType.universal;
var externalId = "someId";
var continueAnon = true;
var extraJson = {"key":"value"};
ServerResponse result = await _bc.identityService.detachAdvancedIdentity(authenticationType:authenticationType, externalId:externalId, continueAnon:continueAnon, extraJson:extraJson);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
// N/A
// N/A
JSON Response
{
"status": 200,
"data": null
}
Common Error Code
Status Codes
Code | Name | Description |
---|---|---|
40210 | DOWNGRADING_TO_ANONYMOUS_ERROR | Occurs when detaching the last non-anonymous identity from an account with continueAnon set to false. |
40206 | MISSING_IDENTITY_ERROR | A "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. |
40209 | SECURITY_ERROR | Returned if a security exception was encountered. |