cgisca / PGSGP

Play Games Services plugin for Godot Game Engine - Android
MIT License
217 stars 61 forks source link

Update SignIn result: add token and email #48

Open Hamdiovish opened 3 years ago

Hamdiovish commented 3 years ago

This is actually an updated version of the PR #35. This PR add support to request email, profile and token id within the signin call. The token id can be used for server side logics such auth and getting user details. So the result of "_on_sign_in_success()" callback will be in the fallowing format: {"displayName":"lorem","email":"lorem@gmail.com","id":"0123456789","token":"lorem_epsum"}

Note: the requestToken must be created first in the google cloud console as a "OAuth 2.0 Client IDs" of a web application: https://console.cloud.google.com/apis/credentials

Note: this PR isn't a duplication of the "Player Info" section, since the "token id" can be retrieved only at the sign in level.

Regards

oneseedfruit commented 3 years ago

Thanks for the pull request! (I'm not the owner of this repo, just someone grateful for your work)

I have the OAuth Client ID of type "Web application" already created and I've tried using it but having a non-empty requestToken like so:

play_games_services.init(true, false, false, "<my web application client id>")

would result in a perpetually loading pop-up that appears after tapping on an account to sign-in:

20210201_193002

It never managed to get sign in to Google Play Games Services though.

However if I were to leave requestToken empty:

play_games_services.init(true, false, false, "")

it always signs in successfully.

Strangely, before trying out your pull request, if I were to use initWithSavedGames instead of init, the same thing always happened with that perpetual loading.

It might be something I miss when it comes to configuring Google Play Console, but I can't figure it out.

oneseedfruit commented 3 years ago

I found that this may be the cause?: https://github.com/cgisca/PGSGP/issues/58

oneseedfruit commented 3 years ago

Found the fix: https://github.com/cgisca/PGSGP/issues/58#issuecomment-772416915

Caused by deprecated API. :'( This solved the problem of not able to use init with Savved Games.

However using this pull request to get token doesn't work.