Google Play Games Authorization

I’m attempting to register players with a Google Play Games token and I get the following error with an invalid/bad request response: no sub in google play access token

As this is coming from Accelbyte could anyone share some light as to what’s missing and where I would need to correct it?

Hi @GG_JamesBattersby,

I’ll forward your error message to the internal team to get more information on what might be missing.

In the meantime, have you followed our official guide on setting up Google Auth?

Hi @GG_JamesBattersby,

Our internal team needs more information to assist you further:

  1. Which SDK are you using? And what version?
  2. How are you obtaining the Google Play token? Is it an auth code or idtoken?
  3. If you are using our SDK, which function are you using to pass the token?

This information will help us better understand the issue and provide the necessary assistance.

Hi @Damar ,

Thank you for your assistance.

  1. AccelByte Unity SDK 16.24.0 with Google Play Games 11.01
  2. It’s an auth code, see code snippet below:
  3. LoginWithOtherPlatform

Sign in code:

    private bool _signingIn;
    private string _authCode;
    private bool _attemptingManual;

    private void Start()
    {
      SignIn();
    }

    private void SignIn()
    {
      if (!_signingIn)
      {
        _signingIn = true;
        PlayGamesPlatform.Activate();
        PlayGamesPlatform.Instance.Authenticate(ProcessAuthentication);
      }
    }

    public override void Login(User user, ResultCallback<TokenData, OAuthError> callback)
    {
      if (_signingIn)
      {
        IEnumerator WaitForGooglePlayGamesSignInAttempt()
        {
          yield return new WaitUntil(() => !_signingIn);
          SignIntoAccelbyte(user, callback);
        }
        StartCoroutine(WaitForGooglePlayGamesSignInAttempt());
      }
      else
      {
        if (Social.localUser.authenticated)
        {
          SignIntoAccelbyte(user, callback);
        }
        else
        {
          callback?.Invoke(Result<TokenData, OAuthError>.CreateError(new OAuthError()));
        }
      }
    }

    private void ProcessAuthentication(SignInStatus status)
    {
      if (status == SignInStatus.Success)
      {
        PlayGamesPlatform.Instance.RequestServerSideAccess(true, (string authCode) =>
        {
          _authCode = authCode;
          _signingIn = false;
        });
      }
      else
      {
        if (_attemptingManual)
        {
          _attemptingManual = false;
          _signingIn = false;
        }
        else
        {
          _attemptingManual = true;
          PlayGamesPlatform.Instance.ManuallyAuthenticate(ProcessAuthentication);
        }
      }
    }

    private void SignIntoAccelbyte(User user, ResultCallback<TokenData, OAuthError> callback)
    {
      void LoginResultCallback(Result<TokenData, OAuthError> result)
      {
        if (result.IsError)
        {
          _authCode = null;
        }
        callback?.Invoke(result);
      }
      user.LoginWithOtherPlatform(PlatformType.GooglePlayGames, _authCode, LoginResultCallback);
    }

I’ll try the Google method but that’s not an ideal choice.

I am facing a similar issue with the Apple Sign In procedure - it returns a:

{"error":"invalid request"}

Update: the Google login scope works with above code, only PlatformType.GooglePlayGames is now PlatformType.Google

I however have the same issue as described in Updating username isn’t reflected in the dashboard

Going through the package code it looks like the Google Play Games interface hasn’t been implemented yet. The nearest equivalent I can find is NullGooglePlayGamesImp which has the following implementation:

public Models.AccelByteResult<SignInGooglePlayGamesResult, Core.Error> GetGooglePlayGamesSignInToken()
        {
            var result = new Models.AccelByteResult<SignInGooglePlayGamesResult, Core.Error>();
            result.Reject(new Core.Error(Core.ErrorCode.NotImplemented, "AccelByte Google Play Games Extension is not installed. Please contact AccelByte support."));
            return result;
        }

Is there an additional package to be installed or is this still in development? The same goes for Apple

Hi @GG_JamesBattersby

Currently we only support integration with Google Play Games 10.14, because 11.01 isn’t supporting external integration.
SDK 16.24.0 has easier mobile integration but we are still working on the documentation. We will back to you as soon as possible, sorry for the inconvenience.

11.01 came out over a year ago. PlayFab had a similar issue which they have resolved somehow albeit it comes with a different account type

@GG_JamesBattersby we have released an extension to make the integration easier.

To install the extension and implement Google login into your game, please follow the guideline on the Readme.

We also have Apple Extension that you can download from here

Hitting an error during a build:
Packages\accelbyte-unity-sdk-google-play-main\Runtime\AccelByteGooglePlayGamesImp.cs(13,13): error CS0103: The name 'GooglePlayGamesExtension' does not exist in the current context

Additionally the com.accelbyte.UnitySDKGooglePlayGames assembly definition is potentially missing a reference?

Have you imported GooglePlayGamesPlugin-0.10.14-AccelByte.unitypackage?

You are able to find it inside _Install/ directory.
image

Yes, after trying it with 11.01 which doesn’t work with the extensions

Unfortunately our services currently unable to integrate with 11.01/Play Games Services v2.
Is there any particular features you need from 11.01?

None in particular at the moment however the improvements listed here are preferable as they provide a better experience for players.

Additionally, Google have a persistent reputation for sunsetting features and older versions of anything they make with little to no warning, forcing developers to update and in some cases prevent updating apps/games without upgraded features. So for developers it’s a constant battle to keep up to date.

Thank you for sharing your concern @GG_JamesBattersby.
We are aware there’s possibility Google might sunsetting PGS v1 and we are still developing v2 integration.
We will notify you if we have any updates related to this.