question

Tobias Lint avatar image
Tobias Lint asked

iOS Google Login

Hey everybody,


I am currently trying to implement the google login scenario described in the PlayFab Tutorials. In the tutorial it is said that I need to install the Google Play Games SDK. My Problem is that on the GitHub page there is this notice:

"NOTICE: This version of the plugin no longer supports iOS. Google Play games services for iOS is deprecated, and is not likely to function as expected. Do not use Google Play games services for iOS in new apps. See the deprecation announcement blog post for more details."

Does anybody have an idea how to go on from here? Obviously the Google SDK is not working with iOS but the PlayFab tutorial is referencing it.

Authentication
10 |1200

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

Tobias Lint avatar image
Tobias Lint answered

If anybody is interested I found the Solution for my problem in this Post of @TCROC. Works like a charm. The AccessToken Variable is still missing in the SDK though.... His post was in late April of 2020. Is there a reason for this I am not seeing?

2 comments
10 |1200

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

JayZuo avatar image JayZuo ♦ commented ·

This is because using access tokens on the server is not recommended by Google. Instead, we should use GetServerAuthCode flow. For more details, see: https://android-developers.googleblog.com/2016/01/play-games-permissions-are-changing-in.html.

To implement Google Sign-In for iOS, please refer to Get started with Google Sign-In for iOS | Google Developers. To get serverAuthCode for iOS, see Access Google APIs from your app backend | Google Sign-In for iOS. Also, this answer: https://community.playfab.com/answers/25170/view.html may help you.

0 Likes 0 ·
Dan Wilson avatar image Dan Wilson commented ·

I actually made this change to the SDK and submitted a Pull Request.
I know Google prefers to use the auth code flow, but this is a standard practice with OAuth and very useful if you are using their native iOS login SDK.

0 Likes 0 ·
Seth Du avatar image
Seth Du answered

Please note that “Google Play Games Login” and “Google Login” are different service. Google Play service is more like Game Center in iOS and Google Play Games Services is deprecated in iOS for a long time.

You are still able to implement this service in Android Devices and The tutorial provides Unity integration. As you can see there are also Google authentication tutorial on Setting up PlayFab authentication using Google and HTML5 - PlayFab | Microsoft Docs, which is supported on iOS, if you are interested in Google login for cross platforms, you can refer to this doc.

3 comments
10 |1200

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

Tobias Lint avatar image Tobias Lint commented ·

Thank you for clearing that up for me. I will look into the tutorial you suggested. Looks fine to me.

0 Likes 0 ·
Tobias Lint avatar image Tobias Lint commented ·

So I tried to implement it via the Tutorial you mentioned. But there is a problem that I cannot solve from the tutorial alone since most of the authentication logic is hidden within some java script libraries that I cannot access within Unity and the example html does not work in general.

Basically I have built an authentication with the registered Google Credentials and I am trying to create the ServerAuthCode that I would pass to the PlayFab function PlayFabClientAPI.LinkGoogleAccount. The problem is that I don't get any information on what scope I would need to set within the request to google. Also there is no information about what the ServerAuthCode actually is. Is it the auth token or something completely different?

The current Error I get from the SDK when I pass the auth token is invalid_grant details: Malformed auth code

The Documentation on ServerAuthCode is only linking to this which is an implementation with android dependencies. Of course they are not available on iOS.

Thank you for you support.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Tobias Lint commented ·

Have you checked this document? Try Sign-In for iOS | Google Sign-In for iOS | Google Developers. Please understand PlayFab simply uses server auth code to authentication with Google server in the backend. In terms of getting this auth code, PlayFab cannot interfere this process. You may find dedicated support from Google or iOS developer community.

0 Likes 0 ·

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.