question

Amar avatar image
Amar asked

FBLogin: Storing AccessToken for future logins?

I am providing a "Login with Facebook", and "Login as Guest" options to the player on launch.

If the player choses to Login with Facebook, do I store the FBAccessToken & method of Login for future logins? If that is correct, how so you check if the AuthToke is expired? I am guessing it based on the login response from the server?

With DeviceID (guestLogin) I was always calling loginWithDeviceID on AppLaunch, and that gave me the same user.

Now that I have this new Flow, it looks like I need to store the default login method, in the player pref, and have the user login with that type next time.

Authentication
10 |1200

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

brendan avatar image
brendan answered

You certainly can, though if the issue is with the user no longer being signed into Facebook (and so forcing them to sign in, to get a new token), you may want to link an alternate auth mechanism to the account, like a Custom ID that you save locally. It would still be the case that once the Facebook token period has expired, we'll no longer be able to make calls on behalf of the user though (such as to query Facebook friends), so you'll still need that logic somewhere in your title.

10 |1200

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

Amar avatar image
Amar answered

@Brendan Thank for getting back on this. This seems to be working in general, but it looks like I am running into a different issue with player inventory, of two players.

Issue: GetUserInfo is working, but the inventory part seems to be working only in the editor and not on the Device.

- The same exact call is able to get the update VC, both on the device and Editor, but is not getting the inventory items on the device?

Player 1: Created through editor (AndroidID): This player has two items (ship_0, ship_1). I am able to get players inventory using "GetCombinedUserInfo" once the login has been successful.

Player: 2: Created on the Android device, suing FB connect. Brand new user, and also has granted (ship_0, ship_1). The client is able to get the VR, but not the inventory items..

>>> When I login the same "Player 2", using the facebook token in the Unity editor, it is getting both the currency inventory.

I have created a UI debugger, to debut the logs, to be able to see the results from the GetCombinedUsreInfo. In the case of device it is "blank" - But the showing the output on Unity Editor.

Not sure if this is something to do with the timing, the behavior is not consistent Please help.

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.

brendan avatar image brendan commented ·

Can you give me the Title ID and the PlayFab IDs of the two accounts?

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.