question

Ray Barrera avatar image
Ray Barrera asked

How to access google token to call play services

I'm using sign in with google in my game, which works wonderfully. However, I now want to make calls to google play services' REST api via cloud script. My flow would be something like this:

game client reports event -> cloudscript validates event vs title data -> cloudscript unlocks playfab achievement, and -> cloudscript reports achievement to google play game services

Is there a way to retrieve the token we got form login? If not, would the correct approach be to implement my own login via cloudscript so that I can store that server(playfab)-side?

Thanks

Player DataCloudScriptAuthentication
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

·
brendan avatar image
brendan answered

The access token we get from Google in exchange for the Server Auth Code needs to be kept secure, so it is not returned by any API call. Ideally, the best solution would be for us to have an integration in PlayFab with the services in question directly, but short of that, I'd have to recommend either using the features from the client as their main docs show, or else using the Server Auth Code system to obtain a distinct access token for your calls.

As you say, you'd likely be doing that via Cloud Script and storing the token in user internal data - believe me, I get that. But the difference is that if a bug in the script then causes some behavior that then causes Google to invalidate the token, that wouldn't then impact any built-in integrations we have.

1 comment
10 |1200

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

Ray Barrera avatar image Ray Barrera commented ·

I'll most likely go with the request-my-own-token route so that I can leave the achievement logic server-side.

Thanks for the info!

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.