SmartSwitchAuthenticateApple
Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type.
In event the current session was previously a completely anonymous account, the smart switch will delete that profile (since completely anonymous accounts are irretrievable once you switch away from them).
Use this function to keep a clean designflow from anonymous to signed profiles.
Authenticate the user with Sign in with Apple.
Method Parameters
Parameter | Description |
---|---|
appleUserId | The user id of the authenticated user. It should match the sub field of the identity token. This is the identifier that will be attached to the user's profile. |
identityToken | The JSON Web Token that represents the user's identity |
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 appleUserId = "123456789";
string identityToken = "identityTokenFromApple";
bool forceCreate = true;
_bc.SmartSwitchAuthenticateAple(
appleUserId, identityToken, forceCreate, SuccessCallback, FailureCallback);
const char* appleUserId = "123456789";
const char* identityToken = "identityTokenFromApple";
bool forceCreate = true;
_bc->smartSwitchAuthenticateApple(appleUserId, identityToken, forceCreate, this);
NSString * appleUserId = @"123456789";
NSString * identityToken = @"identityTokenFromApple";
BOOL forceCreate = true;
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc smartSwitchAuthenticateApple]
appleUserId:appleUserId
identityToken:identityToken
forceCreate:forceCreate
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String appleUserId = "123456789";
String identityToken = "identityTokenFromApple";
boolean forceCreate = true;
this; // implements IServerCallback
_bc.smartSwitchAuthenticateApple(
appleUserId,
identityToken,
forceCreate,
this);
var appleUserId = "123456789";
var identityToken = "identityTokenFromApple";
var forceCreate = true;
_bc.smartSwitchAuthenticateApple(appleUserId, identityToken, forceCreate, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var appleUserId = "1234500123.xxxxxxxx6789";
var identityToken = "identityTokenFromApple";
var forceCreate = true;
ServerResponse result = await _bc.smartSwitchAuthenticateApple(
appleUserId:appleUserId,
identityToken:identityToken,
forceCreate:forceCreate);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
// N/A
// N/A
JSON Response
var appleUserId = "123456789";
var identityToken = "identityTokenFromApple";
var forceCreate = true;
_bc.smartSwitchAuthenticateApple(appleUserId, identityToken, forceCreate, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});