You need to have a Game Server credential configured in addition to the Android credential so that you can send the token to a 3rd party server (Unity Authentication in this case). The Game Server credential should have a Web Application type OAuth client.
Once you have the OAuth client configured, add the ID in the textbox I have highlighted on the GPGS Android Setup window:
I have everything setup like that. Web id and successful connection. I get the token via PlayGamesPlatform.Instance.RequestServerSideAccess, and when I pass it to SignInWithGoogleAsync, i get 401 permission denied.
internal void ProcessAuthentication(SignInStatus status)
{
String c;
if (status == SignInStatus.Success)
{
// Continue with Play Games Services
// print(PlayGamesPlatform.Instance.GetUserId());
PlayGamesPlatform.Instance.RequestServerSideAccess(
/* forceRefreshToken= */ false,
code => {
Debug.Log(c);
SignInWithGoogleAsync(c);
});
}
else
{
// Disable your integration with Play Games Services or show a login button
// to ask users to sign-in. Clicking it should call
// PlayGamesPlatform.Instance.ManuallyAuthenticate(ProcessAuthentication).
print("no");
}
}
Instead of using RequestServerSideAccess() could I ask you to try retrieving the id token from the local user instead. So, your code snippet should look like this:
internal void ProcessAuthentication(SignInStatus status)
{
String c;
if (status == SignInStatus.Success)
{
// Continue with Play Games Services
// print(PlayGamesPlatform.Instance.GetUserId());
c = ((PlayGamesLocalUser)PlayGamesPlatform.Instance.localUser).GetIdToken();
SignInWithGoogleAsync(c);
}
else
{
// Disable your integration with Play Games Services or show a login button
// to ask users to sign-in. Clicking it should call
// PlayGamesPlatform.Instance.ManuallyAuthenticate(ProcessAuthentication).
print("no");
}
}
I’ve got the same problem.The new version of GooglePlayGamesPlugin-0.11.01 seems like change methods a lot of it’s api.There is no longer “GetIdToken()” method in class PlayGamesLocalUser.
Is that means we can’t get IDToken of Google Play sign-in any more, and unity authentication don’t support GooglePlayGamesPlugin-0.11.01 yet.
Or if we can use PlayGamesLocalUser.id instead of PlayGamesLocalUser.GetIdToken() to pass to SignInWithGoogleAsync(idToken)? I don’t know.
Ah, that is very true. I have v0.10.14 in my project currently and hadn’t realised that the GetIdToken() function had been removed in v0.11.01. I will update my GPGS SDK and investigate. Please bear with me.
Thanks for waiting. Unfortunately, in the process of investigation I have actually found a bug. Currently, Unity Authentication is not compatible with the latest version of the Play Games Plugin for Unity as that version uses the new Play Games Services SDK and provides a different token in the response for RequestServerSideAccess(). The backend for Unity Authentication hasn’t been updated to be able to handle the new token type just yet. I have reported the issue directly to the developers and I will make sure to provide an update whenever I get new information about the resolution of this issue.
Unfortunately, I don’t currently have any new updates. The developers are still working on resolving this issue and you should still use v0.10.14. However, it does seem that they are close to the resolution and will likely release a fix soon. I will make sure to post on this thread as soon as I know the fix has been released.
I checked with the team, this is addressed in 2.1.0 of the Authentication SDK and is going through the release pipeline at the moment. Keep an eye out for updates!
Where will we be able to see the new SDK once it gets through the release pipeline? Looking at the release notes I don’t see it for Unity yet unfortunately. https://firebase.google.com/support/releases