question

graemelaws avatar image
graemelaws asked

Google server auth token expiry

Hi,

I'm currently implementing a way for our users to secure their account with google login so they can retrieve the account on different devices. However, I've run in to problems.

We are logging the user into their account, and retrieving a server auth code to use for interaction with PlayFab. Then we call LoginWithGoogleAccount, passing the auth code, and if the account exists, we receive a successful login and at that point we can link the users device to that account to replace the existing one associated with that device id.

However, if a PlayFab account associated with the users Google account does not exist, then we must call LinkGoogleAccount to link the users Google account with the current PlayFab account associated with their device.

The problem is that because the server auth token was used to attempt to login, it has now expired. The only way to receive a new server auth token is to log the user out of their account, and log them back in again. The silent login does not provide a new server auth token, just the same previously used one. This results in more popups for the user to ask them to select their google account for a second time. We do not wish for this to happen.

Is there any work around for this? I am aware that we can send the auth token to a backend and exchange it for access and refresh tokens, but will these work with PlayFab for the Logging in / Linking accounts?

Thanks,

Graeme.

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

·
JayZuo avatar image
JayZuo answered

I'm not sure which SDK you are using, but Google Play Games plugin for Unity supports Getting another server auth code after exchanging the first code. According to the doc, this method is implemented by calling Google Sign-in silently which returns a new server auth code when already signed in. So, I'd think the silent login should be able to provide a new server auth code. If it does not work for you, I'd suggest you contact Google support to get expert help.

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.