Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Authentication Issue with Play Games Plugin for Unity

Discussion in 'Formats & External Tools' started by HoWengYew, Sep 16, 2017.

  1. HoWengYew

    HoWengYew

    Joined:
    Sep 16, 2017
    Posts:
    2
    Unity Version: 5.3.4f1
    Plugin used: https://github.com/playgameservices/play-games-plugin-for-unity

    Able to authenticate and sign out, but not able to log back in unless the application is restarted.

    I have tried checking with "Social.localUser.authenticated" and signing out with "((GooglePlayGames.PlayGamesPlatform)Social.Active).SignOut()", which makes no difference.

    Script:

    using UnityEngine;
    using UnityEngine.UI;
    using System.Collections;

    using GooglePlayGames;
    using GooglePlayGames.BasicApi;
    using UnityEngine.SocialPlatforms;

    public class GooglePlayGamesScript : MonoBehaviour
    {
    void Start ()
    {
    PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
    // enables saving game progress.
    .EnableSavedGames()
    // registers a callback to handle game invitations received while the game is not running.
    // .WithInvitationDelegate(<callback method>)
    // registers a callback for turn based match notifications received while the
    // game is not running.
    // .WithMatchDelegate(<callback method>)
    // requests the email address of the player be available.
    // Will bring up a prompt for consent.
    .RequestEmail()
    // requests a server auth code be generated so it can be passed to an
    // associated back end server application and exchanged for an OAuth token.
    .RequestServerAuthCode(false)
    // requests an ID token be generated. This OAuth token can be used to
    // identify the player to other services such as Firebase.
    .RequestIdToken()
    .Build();

    PlayGamesPlatform.InitializeInstance(config);
    // recommended for debugging:
    PlayGamesPlatform.DebugLogEnabled = true;
    // Activate the Google Play Games platform
    PlayGamesPlatform.Activate();

    }


    public void Authenticate()
    {
    if (!PlayGamesPlatform.Instance.IsAuthenticated())
    {
    Social.localUser.Authenticate((bool success) =>
    {
    // handle success or failure
    });
    }
    else
    {
    PlayGamesPlatform.Instance.SignOut();
    }

    }
    }
     
  2. Nantukk

    Nantukk

    Joined:
    Jan 23, 2013
    Posts:
    1
    sorry to necro, but I have the exact same issue on Unity 2018.4.0 using GPGS version 0.9.64.
    After authenticating in then signing out, the system just hangs on the subsequent call to Social.localUser.Authenticate, it never returns. Did anyone ever find a solution to this?
     
  3. mitchmeyer1

    mitchmeyer1

    Joined:
    Sep 19, 2016
    Posts:
    32