question

amazdeh avatar image
amazdeh asked

finding attached player id which a google id is attached to in Unity

I want to implement the functionality to link a google account (google play game services id specifically) to a playfab id which is currently logging in using device based authentication.

As long as it works great, there are two error conditions AccountAlreadyLinked and and LinkedAccountAlreadyCliamed which are not so clear. based on my testing , first one is when the google account is attached to another playfab account and second one should be when the current (loggedin) playfab account already has a google account linked, right?
Now in order to show a meaningful message to the user about replacing the current link or keeping current account attached to google, i need to know the playfab id of the player which currently is linked to the google account. The issue is GPGS itself doesn't require Google+ account permisions and does not return your google+ id when you do `GetUserId()` but your GetPlayfabIdsFromGoogleIds requires the google+ Id of the user.

What should we do to be able to get the playfab id of a google account id specifically in Unity? do we have to ask for G+ permisions and use other APIs to really get the G+ id? This is very inpractical since i guess other than Google's CEO and maybe a few other people, nobody uses G+ much these days and many younger people don't have G+ at all.

We need the ID to be able to read some title data of the player in our game servers and tell the player which is the XP and Level of the other account at least when asking to replace

Please shed some light on how we should move forward

Cheers

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

For the question on the error code meanings, please see this post: https://community.playfab.com/questions/7570/accountalreadylinked-vs-linkedaccountalreadyclaime.html (LinkedAccountAlreadyClaimed would mean that the Google account is already linked to another PlayFab ID).

For the ID, if the Google account is already linked to a PlayFab account, you can simply log into that account using LoginWithGoogleAccount, which would allow you to get their Google ID (from GetAccountInfo).

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.

amazdeh avatar image amazdeh commented ·

Yes i get that i can login with the other account and read the info and then log back in with my own account. Is there an easy way in the Unity SDK to do login with the GoogleAccount but don't replace the session key in Playfab with the one in that so i can keep my current user logged in and use its session key.for other APIs? Could not find anything in PlayfabClientAPI to get/set sessionTicket

I want to prevent having a flow like this
try to link
if failed with account claimed then login with the google acount
read info
log back in using the original device account which was being used on the device

Also I have to make sure this is side-effect free which makes it more painful, we designed the app with the assumption that login happens in the initial scene and only once which should be a good assumption most of the times.

For example is it secure to send the auth token to my own game server to do these operations?

0 Likes 0 ·
brendan avatar image brendan amazdeh commented ·

No, sorry - logging in necessarily updates the session ticket for the client. But that said, there's nothing preventing you from having this be side-effect free. All you need to do is sign into the account, read the data you need, then sign back into the other account. And yes, you can also send the session ticket to your own game server if you like, to have it take action on the client account (though it's easier to just use the PlayFab ID).

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.