AttachParentWithIdentity
Attach a parent identity to the current profile. Create if necessary.
Service | Operation |
---|---|
identity | ATTACH_PARENT_WITH_IDENTITY |
Method Parameters
Parameter | Description |
---|---|
externalId | User ID |
authenticationToken | Password or client side token |
authenticationType | Type of authentication. Full list of types can be found here. |
externalAuthName | The name of the external authentication mechanism (optional, used for custom authentication types) |
forceCreate | Whether to create the profile if it does not exist |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string externalId = "email@email.com";
string authenticationToken = "email@email.com";
AuthenticationType authenticationType = AuthenticationType.Email;
string externalAuthName = "";
bool forceCreate = true;
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};
_bc.IdentityService.AttachParentWithIdentity(externalId, authenticationToken, authenticationType, externalAuthName, forceCreate, successCallback, failureCallback);
const char *externalId = "email@email.com";
const char *authenticationToken = "email@email.com";
AuthenticationType authenticationType = AuthenticationType::Email;
const char *externalAuthName = "";
bool forceCreate = true;
_bc->getIdentityService()->attachParentWithIdentity(externalId, authenticationToken, authenticationType, externalAuthName, forceCreate, this);
NSString *externalId = @"email@email.com";
NSString *authenticationToken = @"email@email.com";
AuthenticationTypeObjc authenticationType = [AuthenticationTypeObjc Email];
NSString *externalAuthName = @"";
bool forceCreate = true;
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc identityService] attachParentWithIdentity:externalId
authenticationToken:authenticationToken
authenticationType:authenticationType
externalAuthName:externalAuthName
forceCreate:forceCreate
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String externalId = "email@email.com";
String authenticationToken = "email@email.com";
AuthenticationType authenticationType = AuthenticationType.Email;
String externalAuthName = "";
boolean forceCreate = true;
this; // implements IServerCallback
_bc.getIdentityService().attachParentWithIdentity(externalId, authenticationToken, authenticationType, externalAuthName, forceCreate, 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 externalId = "email@email.com";
var authenticationToken = "email@email.com";
var authenticationType = "_bc.identity.authenticationType.email;
var externalAuthName = "";
var forceCreate = true;
_bc.identity.attachParentWithIdentity(externalId, authenticationToken, authenticationType, externalAuthName, forceCreate, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var externalId = "email@email.com";
var authenticationToken = "email@email.com";
var authenticationType = AuthenticationType.email;
var externalAuthName = "";
var forceCreate = true;
ServerResponse result = await _bc.identityService.attachParentWithIdentity(externalId:externalId, authenticationToken:authenticationToken, authenticationType:authenticationType, externalAuthName:externalAuthName, forceCreate:forceCreate);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var externalId = "email@email.com";
var authenticationToken = "email@email.com";
var authenticationType = "Email";
var externalAuthName = "";
var forceCreate = true;
var identityProxy = bridge.getIdentityServiceProxy();
var postResult = identityProxy.attachParentWithIdentity(externalId, authenticationToken, authenticationType, externalAuthName, forceCreate);
if (postResult.status == 200) {
// Success!
}
{
"service": "identity",
"operation": "ATTACH_PARENT_WITH_IDENTITY",
"data": {
"externalId": "email@email.com",
"authenticationToken": "email@email.com",
"authenticationType": "Email",
"externalAuthName": "",
"forceCreate": true
}
}
JSON Response
{
"status": 200,
"data": {
"profileId": "1234-1234-1234-1234",
"newUser": false
}
}