DetachEmailIdentity
Detach the e-mail 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.DetachEmailIdentity(email, true);
break;
}
case ReasonCodes.MISSING_IDENTITY_ERROR: { // User attempted to detach an identity that doesn't exist
// Need to provide the correct 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;
}
}
}
Service | Operation |
---|---|
identity | DETACH |
Method Parameters
Parameter | Description |
---|---|
The user's e-mail address | |
continueAnon | Proceed even if the profile will revert to anonymous? |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string email = "email@domain.com";
_bc.IdentityService.DetachEmailIdentity(
email,
true,
SuccessCallback, FailureCallback);
const char * email = "email@domain.com";
_bc->getIdentityService()->detachEmailIdentity(
email, false, this);
- (void)detachEmailIdentity:(NSString *)email
continueAnon:(bool)continueAnon
completionBlock:(BCCompletionBlock)cb
errorCompletionBlock:(BCErrorCompletionBlock)ecb
cbObject:(BCCallbackObject)cbObject;
public void detachEmailIdentity(String email, boolean continueAnon, IServerCallback callback)
_bc.identity.detachEmailIdentity = function(email, continueAnon, callback)
var email = "email@domain.com";
var continueAnon = true;
ServerResponse result = await _bc.identityService.detachEmailIdentity(email:email, continueAnon:continueAnon);
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. |