question

Thomas Brown avatar image
Thomas Brown asked

How should we LoginWithGoogle (after first sign in) via iOS when subsequent google sign in calls don't return a serverAuthCode

After doing some extensive work with PlayFab / Google Sign In it looks like everything is working pretty well aside from one defect.

PlayFabs LoginWithGoogleAccount method expects a ServerAuthCode to be set. The problem here is that for iOS the default behavior is to only return a ServerAuthCode on the very first sign in attempt. All subsequent attempts will no longer return the ServerAuthCode.

This leaves me wondering how were supposed to sign in with google via PlayFab for subsequent google sign in attempts when the ServerAuthCode is not returned.

The only thing I can think of now is always signing out the user then resigning them back in to get a server auth code on ios. The issue here is that it's a bit cumbersome to have the user always have to select their google account every time they open up the game.

Account Management
10 |1200

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

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

Do you use iOS SDK? Maybe you need to solve the problem that how to get serverAuthCode on iOS apps(after first sign in). Then you can use it with PlayFab API LoginWithGoogleAccount. Google’s guides Try Sign-In for iOS may provide a workaround. Like Enable server-side API access for your app, so your servers will be able to make Google API calls on behalf of users or while they are offline. We don’t have some test environment temporarily, so haven’t tested it. Please let me know if it can help you.

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.

Thomas Brown avatar image Thomas Brown commented ·

So I'm actually using this package in order to do the auth flow for both iOS and Android.

https://github.com/googlesamples/google-signin-unity.

I have followed both the guides you suggested, that's actually the way I was able to get it working.

The problem is that the default behavior for iOS is to only send the serverAuthCode on the first sign in. There is no settings and or way to change this as Google has stated it's the default sign in behavior for iOS.

See here

https://github.com/googlesamples/google-services/issues/151

This makes me wonder if PlayFab needs to change it's LoginWithGoogle implementation because as it stands now it looks like on the iOS side we are forced to present the Google sign in prompt every time so we will get the serverAuthCode.

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Thomas Brown commented ·

Thank you for your explanation. Now I understand that Google states such default sign-in behavior for iOS. Do you mean that you would like to log in PlayFab with Google Account but you wouldn't like to sign in Google manually every time? If so there is currently no workaround from PlayFab side. Now on HTML5, there may be another solution about cross-platform automatically LoginWithGoogleAccount, you can refer to this doc. It may not be the best way for your project. Even from the user side, there is a possible solution, please check it if you are interested. If you still can't find a possible workaround, you can try to add a feature request for changing LoginWithGoogle implementation.

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.