Skip to main content
Version: 5.7.0

AttachUniversalIdentity

Attach a Universal (userid + password) identity to the current profile.

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 Universal, and detach it first. see GetIdentities
_bc.IdentityService.DetachUniversalIdentity(oldUserId, oldPassword);
// Then, can add a new Identity of that type
_bc.IdentityService.AttachUniversalIdentity(userId, 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.MergeUniversalIdentity(userId, 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
userIdThe user's user ID
passwordThe user's password

Usage

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

_bc.IdentityService.AttachUniversalIdentity(
userId,
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 Universal 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 Universal account).
550022INVALID_PASSWORD_CONTENTThe password doesn't meet the minimum password requirements.