Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Google vs Goole Play Games

Discussion in 'Authentication' started by Calthies4, Jul 17, 2022.

  1. Calthies4

    Calthies4

    Joined:
    Jan 18, 2017
    Posts:
    12
    Hello,

    I've been following the instructions at https://docs.unity.com/authentication/ for setting up unity authentication.

    I got the Anonymous authentication working pretty easily - however my end goal is to allow Google account login for cross platform cloud save and account support.

    I am getting very confused reading through this... either there seems to be an error in the documentation, or I am misunderstanding how something is supposed to work here.

    There are two google related sign in providers - Google and Google play games. They are listed separately in the documentation, they have their own methods in the authentication module, and they each have their own options in the actual Unity Gaming Services dashboard under Live Ops.

    However, under the documentation for the Google platform-specific signin, it references Google play games heavily, as seen below.

    upload_2022-7-16_22-1-53.png

    I would want to use Google sign in because it would be cross platform - if you click on google play games, it clearly states that it only works for Android. This is obviously counter intuitive... am I missing something here?

    I noticed in another thread that the other authentication types (minus facebook) are not truly cross platform either, as they cannot be associated with accounts using other providers. This undermines a lot of the supposed benefits/use cases of using Unity's authentication. I understand this is all still under construction and something may potentially be in the works, but wanted to voice the concern that most of these sign in options are fairly useless when it comes to cross platform support.

    On another note, a nice example is given for getting the Google play games IdToken in the linked "Set up a Google Play Games sign-in" - however no example is given for getting the Google IdToken, and the page states it assumes you already have it. I've done some looking around and didn't see any easy code to reference for making this work, except an outdated example from google.
     
    DavidZobrist, ilmario and Holmes555 like this.
  2. Calthies4

    Calthies4

    Joined:
    Jan 18, 2017
    Posts:
    12
    Is anyone able to speak to this? Is the documentation incorrect as I assumed it is, or am I completely off base here?
     
  3. chengg_unity

    chengg_unity

    Unity Technologies

    Joined:
    May 15, 2022
    Posts:
    24
    Hello @Calthies4 ,

    Thank you so much for reaching out! Apologies for the late response.
    Early this week, some links were missing from our documentation page, this was addressed yesterday.
    1. The key difference between Google Sign-in and Google Play Games Sign-in is the Play Games Services SDK version used. Google Sign-in is using v1 and Play Google Play Games is using v2.
    2. We are investigating to expand the cross-platform support. First, we will provide the OpenID Connect support to allow the developers to integrate with their existing OIDC-compliant providers.
      I understand this still doesn't address the cross-platform use case for developers who don't have use an OIDC provider, but we are exploring different options to support this. Thank you for your feedback.
    Best regards,
    Cheng
     
  4. Calthies4

    Calthies4

    Joined:
    Jan 18, 2017
    Posts:
    12
    Thank you for the response, @chengg_unity ,

    I still have some questions after reading through the updated documentation.

    It mentions that signing in with a Google account (not google play) still requires the use of the google play games plugin - which subsequently looks like it requires you to set up an app within google play games. At that point I don't consider that a google login - it is a google play login. The spot that is confusing me the most is this: https://github.com/playgameservices/play-games-plugin-for-unity#configure-your-game

    I was hoping to simply set up a google cloud project for my game, generate an OAuth 2.0 Client ID, and tie that into the unity authentication package. The authentication settings within project settings seemed to be what I was looking for:

    upload_2022-7-23_22-4-44.png

    But the documentation doesn't seem to be lining up with using this.

    It sounds like an eventual OpenID Connect support would solve this problem, if I understand correctly.

    Thanks again for the response - sorry if I'm being a dunce about this.
     
  5. shuz_unity

    shuz_unity

    Unity Technologies

    Joined:
    Jun 12, 2019
    Posts:
    2
    Hi @Calthies4,

    In the latest Google Play SDK, the id token is no longer available from the client side. Also for the server side auth code you are not able to add additional scopes. So we can only get the player ID rather than the user ID from Google. If you want to have a silent Google Play Games login flow, you need to use this ID provider.

    In Google sign-in, we expect an ID token with the user ID returned to us. Technically it would work on all platforms, but unfortunately there isn't native Unity SDKs available. So to get the token it has to be done by calling the native SDKs.

    Once you are able to get the token back, put the web client ID there and send the ID token you got. The login should success with the ID token.

    References to the native SDKs:
    * Android:
    * https://developers.google.com/identity/one-tap/android
    * https://developers.google.com/identity/sign-in/android/start
    * iOS/macOS:
    * https://developers.google.com/identity/sign-in/ios
    * Web
    * https://developers.google.com/identity/gsi/web

    Thanks,
    Shu
     
    ilmario likes this.
  6. Calthies4

    Calthies4

    Joined:
    Jan 18, 2017
    Posts:
    12
    For anyone curious, I was able to get it working for a windows desktop build by following the example here: https://github.com/googlesamples/oauth-apps-for-windows/blob/master/OAuthDesktopApp/README.md

    It pops open a browser when I click the button to sign in, and the resulting user ID token can be passed into the Link/SignInWithGoogle methods, which do work. Unfortunately I will have to come up with some way to shift focus back to the game after the ID token is received - but that seems doable.

    However, I am a bit at a loss on how to actually integrate this into the game. Once a user does the initial link/sign in action, I would expect there to be a way to automatically sign them in again using the token saved in player prefs, or some similar mechanism. I haven't been able to find anything like that though.. This is evolving into a different question at this point so I will make a new thread.

    Thanks for the help.
     
  7. deceneu88

    deceneu88

    Joined:
    Feb 16, 2022
    Posts:
    1
    I for one am very disappointed in Unity Gaming Services for authentification.
    I really looked forward to functionality, such as authentification, seeing that "Google" is there as a way to sign in my users (not Google Play Services) I was like - "awesome, finally, they did something outstanding". upload_2022-8-13_20-46-37.png
    But reading through the documentation, it is not clear, and reading this forum made it clear that it is misleading. There is no Google authentification - it is still google play gaming services but different sdks. It is still ambiguous how exactly to do this anyway. I'm new to unity and game development (6 months in full-time learning and building) and I can say that GPGS is a pain in the ass. In two games I've not done authentification because I had to deal with the S***ty GPGS SDK, which you don't really know why it runs or not. For authentification I bought 2 dedicated assets from the asset store and yet due to GPGS again I wasted my time and money. So when I saw Authentification with Google by UGS I was excited for a second, just to find the same GPGS SDK needing to be installed and handled.
    Coming back to the new Unity Gaming Services, the documentation on Auth. is rubbish, like any unity feature the documentation for early releases is lacking and it seems that developers starting off (like myself), need to wait for YouTubers to "decipher and complete" the documentation and then we will have a video with a step by step how to exactly achieve x, y, z in the Unity Gaming Services - a long way from what maybe Unity wants it to be which mislead me to believing that it would be a fast and reliable way to get things up and running.
     
    ilmario and Holmes555 like this.
  8. Holmes555

    Holmes555

    Joined:
    Sep 22, 2016
    Posts:
    14
    I didn't see this thread earlier, that's why created new one, but I'll also add it here:
    I want to understand difference between Google sign in option with using Google Play Games plugin for Unity v10.14 and below which uses Play Games Services v1 SDK (description here) vs GooglePlayGames sign in option with using Google Play Games plugin for Unity v11.01 and above which recommends using Play Games Services v2 SDK (description here).

    Because for me it seems like Unity just took two versions of the same library and named them differently. First it was just Google Play Games sign in (which actually they renamed to just Google) and the usage was the same as now in Google. I implemeted that old Google sign in with Authentication service - 1.0.0-pre.37 and it worked as Google Play Games and now they making it as Google sign in.

    My main question is: what's changed or is it the same approach but using different versions of Google Play Games plugin for compatibility? Should I move to the newest one and the functioning would be the same?

    P.S. My old version Google Play Games plugin started to failed on build because of:
    Assets\AssetStore\GooglePlayGames\OurUtils\PlatformUtils.cs(34,39): error CS0246:
    The type or namespace name 'AndroidJavaObject' could not be found (are you missing a using directive or an assembly reference?)
    or
    Assets\AssetStore\GooglePlayGames\OurUtils\PlatformUtils.cs(33,30): error CS0246:
    The type or namespace name 'AndroidJavaClass' could not be found (are you missing a using directive or an assembly reference?)
     
  9. Marc477

    Marc477

    Joined:
    Jan 16, 2017
    Posts:
    129
    Can someone update the doc page titles to be a bit more clear ?
    Instead of
    Google
    Google Play Games

    if should be called
    Google Play Games v1
    Google Play Games v2

    Otherwise its really confusing