Skip to main content
Version: 5.7.0

AttachEmailIdentity

Attach a Email and Password identity to the current profile.

Error Handling Example

public void FailureCallback(int statusCode, int reasonCode, string statusMessage, object cbObject) {
switch (reasonCode) {
case ReasonCodes.DUPLICATE_IDENTITY_TYPE: { // User is attempting to attach an idenity of the type that exists on there account
// Must get old idenity of type Email, and detach it first. see GetIdentities
_bc.IdentityService.DetachEmailIdentity(oldEmail, oldPassword);
// Then, can add a new Identity of that type
_bc.IdentityService.AttachEmailIdentity(email, password);
break;
}
case ReasonCodes.MERGE_PROFILES: { // User to attaching a idenity that is connected to a different profile
/**
* Prompt the user that the identity already exists with a different account.
* Ask if they wish to merge the two accounts, and perform a merge if true
*/
_bc.MergeEmailIdentity(email, password, true);
break;
}
default: { // Uncaught reasonCode
/**
* Log the unexpected reasonCode to your own internal logs,
* to implement needed error handling later
*/
break;
}
}
}
ServiceOperation
identityATTACH

Method Parameters

ParameterDescription
emailThe user's e-mail address
passwordThe user's password

Usage

http://localhost:3000
string email = "email@domain.com";
string password = "somePassword";

_bc.IdentityService.AttachEmailIdentity(
email,
password,
SuccessCallback, FailureCallback);
JSON Response
{
"status": 200,
"data": null
}
Common Error Code

Status Codes

CodeNameDescription
40211DUPLICATE_IDENTITY_TYPEReturned when trying to attach an identity type that already exists for that profile. For instance you can have only one Email identity for a profile.
40212MERGE_PROFILESReturned when trying to attach an identity type that would result in two profiles being merged into one (for instance an anonymous account and a Email account).
40221EMAIL_NOT_VALIDThe provided email address is not in the correct format.
550022INVALID_PASSWORD_CONTENTThe password doesn't meet the minimum password requirements.