GoogleLogin
public void GoogleLogin(GoogleLoginCallback googleLoginCallback);
public void GoogleLoginCallback(bool isSuccess, string errorMessage, string token)
Parameters
Value | Type | Description |
---|---|---|
iosClientId | string | (When the inspector is not configured) iOS client ID set in Google Cloud Platform |
googleLoginCallback | GoogleLoginCallback | Callback method that loads the login request success status, error message, and token value |
Description
Attempts Google login. The result can be checked through the GoogleLoginCallback callback event.
Example
public void StartGoogleLogin() {
TheBackend.ToolKit.GoogleLogin.iOS.GoogleLogin(GoogleLoginCallback);
}
private void GoogleLoginCallback(bool isSuccess, string errorMessage, string token) {
if (isSuccess == false) {
Debug.LogError(errorMessage);
return;
}
Debug.Log("Google token : " + token);
var bro = Backend.BMember.AuthorizeFederation(token, FederationType.Google);
Debug.Log("Federation login result : " + bro);
}
ReturnCase
Success cases
When Google login is called successfully
true
errorMessage : ""
token :
eyJhbGciOiJSUzI1NiIsImtpZCI6Ijg1ZTU1MTA3NDY2YjdlMjk4MzYxOTljNThjNzU4MWY1YjkyM2JlNDQiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhenAiOiI0NTk2MDkyMzQ5MDAtMGZrdHBlbjlsNzYxZjFnc3RvdTI0a2Z0dXNlcGpvZGIuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJhdWQiOiI0NTk2MDkyMzQ5MDAtbnZzaW51bDllMnBvMGU4cGk2aWdqNmlvNGNnN3VmMG4uYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJzdWIiOiIxMTcxMTQ5NTAzOTIxNjIzMzA5MjAiLCJlbWFpbCI6InJsYWd1c3RtZDAyMTdAZ21haWwuY29tIiwiZW1haWxfdmVyDSDjksdajfaskljfkjksuYDtmITsirkiLCJwaWN0dXJlIjoiaHR0cHM6Ly9saDMuZ29vZ2xldXNlcmNvbnRlbnQuY29tL2EvQUNnOG9jSXprNWExOVpaQ3MyRmJ3ZG5FV0xGdDZIZUFMRUY4OUF6TF9rbFlaRXQxPXM5Ni1jIiwiZ2l2ZW5fbmFtZSI6Iu2YhOyKuSIsImZhbWlseV9uYW1lIjoi6rmAIiwibG9jYWxlIjoia28iLCJpYXQiOjE3MDY0NDA2MjMsImV4cCI6MTcwNjQ0NDIyM30.hJx5COWQWmMejDFz76b2NxAB3IcYP3obvQ6CGvwCF6oBQG7rqZzlA9YiQhQwpzd0SM6rt-aFPlrpO6yCF8V_sh2yfI784wf1VNzlhtxoajI_LpDmdny1bWlgpHGv3hwC3lL1Wi9tP2CkEfnlfTXnKXKtsPD1KiaQa8tYZnIXDR_MvnE9FtiNA-vGCclUcUdONgcgF8_tAieKVKJxfIGx2zNNCb19910abbMwkW8-lhWp6kgd
Error cases
When the running device is not iOS
false
errorMessage : "SDK Exception : not support os: [ platform ]"
token : ""(string.Empty)
When the information set in Google Cloud Platform is invalid
bool : false
errorMessage : "GoogleLogin Failed. Reason : 10: "(10: is an error message returned from Google SDK.)
token : ""(string.Empty)
When the login attempt was not from a tester (except the production stage)
bool : false
errorMessage : "GoogleLogin Failed. Reason : 10: "(10: is an error message returned from Google SDK.)
token : ""(string.Empty)
When incorrect webClientID was used
bool : false
errorMessage : "GoogleLogin Failed. Reason : 10: "(10: is an error message returned from Google SDK.)
token : ""(string.Empty)
GoogleSignOut
public void GoogleLogin(GoogleSignOutCallback googleSignOutCallback);
public void GoogleSignOutCallback(bool isSuccess, string errorMessage)
Parameter
Value | Type | Description |
---|---|---|
googleSignOutCallback | GoogleSignOutCallback | Callback method that loads the login request success status, error message, and token value |
Description
Logs out from the Google ID. The account can be reselected upon a subsequent Google login.
Example
public void SignOutGoogleLogin() {
TheBackend.ToolKit.GoogleLogin.iOS.GoogleSignOut(GoogleSignOutCallback);
}
private void GoogleSignOutCallback(bool isSuccess, string error) {
if (isSuccess == false) {
Debug.Log("Google logout error response occurred : " + error);
} else {
Debug.Log("Logout successful");
}
}