SmartSwitchAuthenticateUniversal
Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. In event the current session was previously an anonymous account, the smart switch will delete that profile. Use this function to keep a clean designflow from anonymous to signed profiles
Method authenticates the user using universal credentials
Method Parameters
Parameter | Description |
---|---|
userId | The user's ID. |
password | The password of the user. |
forceCreate | Should a new profile be created for this user if the account does not exist? |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string userId = "userName";
string password = "password";
bool forceCreate = true;
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("[Authenticate Success] {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("[Authenticate Failed] {0} {1} {2}", status, code, error));
};
_bc.SmartSwitchAuthenticateUniversal(userId, password, forceCreate, successCallback, failureCallback);
const char* userId = "userName";
const char* password = "password";
bool forceCreate = true;
_bc->smartSwitchAuthenticateUniversal(userId, password, forceCreate, this);
NSString* userId = @"userName";
NSString* password = @"password";
bool forceCreate = true;
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[_bc smartSwitchAuthenticateUniversal:userId
password:password
forceCreate:forCreate
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String userId = ""userName"";
String password = "password";
boolean forceCreate = true;
_bc.smartSwitchAuthenticateUniversal(userId, password, forceCreate, this);
var userId = "userName";
var password = "password";
var forceCreate = true;
_bc.smartSwitchAuthenticateUniversal(userId, password, forceCreate, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var userId = "userName";
var password = "password";
var forceCreate = true;
ServerResponse result = await _bc.smartSwitchAuthenticateUniversal(
username:userId,
password:password,
forceCreate:forceCreate);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
// N/A
// N/A
JSON Response
var userId = "userName";
var password = "password";
var forceCreate = true;
_bc.smartSwitchAuthenticateUniversal(userId, password, forceCreate, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});