Hello @Rick Chen ,@Sarah Zhang and @Citrus Yan, I am trying to request and get the server auth code after completing the google play games sign-in but it is giving me the error that says:- "[Play Games Plugin 0.11.01] ERROR: Requesting server side access task failed - com.google.android.gms.common.api.ApiException: 10: System.Action:Invoke()" Any idea to resolve this and get the server to auth code for the login in Playfab using Google? And my code is below:-
private void OnSignInButtonClicked()
{
PlayGamesPlatform pGamePlatform = PlayGamesPlatform.Activate();
if (!Social.localUser.authenticated)
{
pGamePlatform.Authenticate((SignInStatus success) =>
{
Debug.Log("SignInStatus is" + success);
if (success == SignInStatus.Success)
{
GoogleStatusText.text = "Google Signed In";
StartCoroutine(GetAuthCode());
}
else
{
GoogleStatusText.text ="Google Failed to Authorize your login";
}
});
}
}
void GetAuthCode()
{
PlayGamesPlatform.Instance.RequestServerSideAccess(true, code =>
{
Debug.Log("Authorization code: " + code);
Token = code;
GotAuthCode();
});
}
void GotAuthCode()
{
if (Token != null && Token.Length > 0)
{
PlayFabClientAPI.LoginWithGooglePlayGamesServices(new LoginWithGooglePlayGamesServicesRequest()
{
TitleId = PlayFabSettings.TitleId,
ServerAuthCode = Token,
CreateAccount = true
}, (result) =>
{
GoogleStatusText.text = "Signed In as " + result.PlayFabId;
}, (OnPlayFabError) =>
{
GoogleStatusText.text = "Signed In failed";
Debug.LogError(OnPlayFabError.Error);
});
}
else
{
GoogleStatusText.text = "not getting the server auth code";
Debug.Log("not getting the server auth code");
}
}