question

Cadrick Loh avatar image
Cadrick Loh asked

Session expired during GetFriendLeaderboard

I got this error when I call GetFriendLeaderboard()

Error validating access token: Session has expired

How should I fix this?

 

NOTE: I'm retrieving Facebook friends' leaderboard

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

Session expiration could refer to one of two things:

1. Your PlayFab session ticket has expired. Re-signing into PlayFab using any valid authentication method would resolve this.

2. Your Facebook token has expired. Querying for an updated token, to use for sign-in to PlayFab would resolve this.

10 |1200

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

Cadrick Loh avatar image
Cadrick Loh answered

I dont understand what u mean in point 2.

Can u elaborate more? perhaps with sample codes?

Everytime when the game starts I will call LoginWithCustomID already. I dont think is PlayFab session ticket expired.

 

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

The problem then, if you're asking for the Facebook friends in the GetFriendLeaderboard call, is that Facebook does not provide us with a way to get an unlimited-time token for their service. You will have to use LoginWithFacebook at some point, if you want to use Facebook features, so that we have a token which is current. This would be using the same code you're already using to get the Facebook token in the Login or Link call where you're making Facebook authentication part of the player account.

10 |1200

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

Cadrick Loh avatar image
Cadrick Loh answered

Meaning after the player linked with Facebook account, next time when the player login with PlayFab I should be calling LoginWithFacebook instead of LoginWithCustomID?

Is that what u mean?

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 can use any authentication mechanism you like to get to your player data, but when it comes to using features which are integrated with third-party services like Facebook, you will sometimes need to authenticate with them (using our Login call, yes), so that we have a current token to their service, and can call into it on your behalf, yes.

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.

Dylan Hunt avatar image Dylan Hunt commented ·

So if the FB account is ALREADY linked to PF, I can call LoginToFacebook and it won't popup a window if the session is expired? It can be a seamless "reconnection"?

If I have multiple accounts linked, would I have to login to ALL of them for a renewed ticket? I'm still confused by this. This is the closest related post I could find in relation to my question.

0 Likes 0 ·
brendan avatar image brendan Dylan Hunt commented ·

If the player is signed into Facebook on the local device, and that device has Facebook integration, the player shouldn't be prompted to sign in.

As to "multiple accounts linked", I'm not sure what you mean. You cannot have more than one PlayFab account in a game linked to the same Facebook account - it can only be linked to one. If you mean across titles, as long as you're using a single Publisher ID across your games (which is the default within a single Studio), you're actually using the same PlayFab account for any sign-in using Facebook, across all games. So in that case, a Facebook sign-in on any of those games updates the token.

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.