AppleLogin
public bool AppleLogin(string webClientId, out string errorMessage, AppleLoginCallback callback);
public bool AppleLogin(string webClientId, out string errorMessage, int left, int top, int right, int bottom, AppleLoginCallback callback);
Parameters
Value | Type | Description | Default |
---|---|---|---|
identifier | string | Certificates, Identifiers & Profiles page > Identifiers > Identifier created from Services IDs | - |
errorMessage | out String | An empty value for success / error information for failure | - |
left | int | Left margin px | 0 |
top | int | Top margin px | 0 |
right | int | Right margin px | 0 |
bottom | int | Bottom margin px | 0 |
callback | AppleLoginCallback | Callback methods called upon successful Apple login | - |
Attempts Apple login. The result can be checked through the callback event.
identifier has the value as shown below.
AppleLoginCallback
This is a handler that is called automatically when a token has been issued. It can be assigned as a variable for AppleLogin.
public delegate void AppleLoginCallback(string token);
private static AppleLoginCallback OnAppleLogin;
OnCloseButtonClick
This is a handler that is called when you quit Apple login with the button on the top right.
public delegate void CloseButtonClickCallback();
public static CloseButtonClickCallback OnCloseButtonClick;
Example
public void StartAppleLogin() {
#if UNITY_ANDROID || UNITY_EDITOR
TheBackend.ToolKit.AppleLogin.Android.OnCloseButtonClick = () => {
Debug.Log("The window has been closed");
};
TheBackend.ToolKit.AppleLogin.Android.AppleLogin("com.thebackend.testapp.applelogin", out var error, token => {
Debug.Log("Token : " + token);
Debug.Log("A token has been issued. You can now log in.");
Backend.BMember.AuthorizeFederation(token, FederationType.Apple, callback => {
Debug.Log("Apple login result : " + callback);
});
});
if (string.IsNullOrEmpty(error) == false) {
Debug.Log("Error : " + error);
}
#endif
}
Error cases
(AuthorizeFederation method) When the entered identifier and the identifier value set from the console do not match
statusCode : 401
errorCode BadUnauthorizedException