question

Jedrzej Jonasz avatar image
Jedrzej Jonasz asked

Login with Google token issue

Hi, I'm having some trouble with the google access token for loginWithGoogle request. I am getting the message "Invalid input parameters" when I try to use the token I get from the Google Play Game Services Unity plugin with the call: 

((PlayGamesLocalUser)Social.localUser).idToken

I get can login to google using the plugin just fine, and it looks like I'm getting a token back from google in ADB. 

Getting ID token.  Scope = audience:server:client_id: ....

I'm not sure if I setup my client id stuff on google's game services dashboard. I originally created an android client but then got a message that I need to create a "web" linked client. I created one and it asked me for a url where my app was located, so I put in my website but maybe I was supposed to use the playfabapi.com url?

-JJ

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

e.timofeev@flexilestudio.com avatar image
e.timofeev@flexilestudio.com answered

Good day! I have a question about GooglePlusLogin.

You example using code for get Google token:





    /// <summary>

    /// Google plus wrapper class was contributed by Hamza Lazâar Twitter: @RealJohnTube

    /// For the purposes of PlayFab authentication, we are only using GetToken(); however, there are many more integrated Google+ features available. 

    /// This class calls a native java plugin which then returns via callback [OnTokenReceivedCallback] to a scene.

    /// </summary>

    /// <param name="callBackObject">This is the name of the gameObject to call back to with the token. (Plugin default = "GooglePlusGO")</param>

    /// <param name="callBackMethod">This is the name of the method to call. (Plugin default = "OnGoogleTokenReceived")</param>

    public static void StartGooglePlusLogin(string callBackObject="Panel_Authentication", string callBackMethod="OnGoogleTokenReceived")

    {

        #if UNITY_ANDROID

        // internal settings for using GooglePlusActivity

        //int SIGN_IN_REASON = 1;

        int GET_TOKEN_REASON = 2;

        //int SIGN_OUT_REASON = 3;

        //int LOAD_CIRCLES_REASON = 4;

        //int REVOKE_ACCESS_REASON = 5;

        //int INVALIDATE_TOKEN_REASON = 6;

        

        string className = "com.ThugLeaf.GooglePlusForUnity.GooglePlusActivity"; //com.ThugLeaf.GooglePlusForUnity.DemoActivity

        AndroidJNI.AttachCurrentThread();

        using( AndroidJavaClass activityClass = new AndroidJavaClass(className))

        {

            //using(AndroidJavaObject activityInstance = activityClass.GetStatic<AndroidJavaObject>("mContext"))

            //{

                activityClass.SetStatic<string>("UnityObjectName", callBackObject); //UnityObjectName

                activityClass.SetStatic<string>("OnTokenReceivedCallback", callBackMethod); //TokenCallbackName

                //activityInstance.Call("GetToken");

                activityClass.CallStatic("Start", new object[] { GET_TOKEN_REASON });

            //}

        }

        #endif

    }


For receive token used callback: "OnTokenReceivedCallback". But if user not choose account or cancel overlay window. Plugin don't call any callback.
How i can receive callback with fail?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Zac Bragg avatar image
Zac Bragg Deactivated answered

Currently, this is not supported with our plugin. To get this you will need to make modifications to the Java source and re-compile the plugin.

A full featured Google API plugin is beyond the scope of what we are supporting, so it is doubtful that any further development will happen on this plugin.

I would suggest that prior to calling the PlayFab API, if you detect any empty fields, then you will want to manually trigger the flow by starting the process again from the beginning.

-Zac

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

marcowilliamspf avatar image
marcowilliamspf answered
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.