question

charlie avatar image
charlie asked

Does LinkFacebookAccount update the Access Token?

We are using Playfab's backend Facebook calls like GetFriendLeaderboardAroundPlayer and we've noticed that these calls occasionally give us an error that the Facebook Access Token has expired.

We normally log in by device id, as we don't want to force Facebook login. Assuming a player's Facebook login has expired (or has been purposefully logged out), when they log back in:

Does LinkFacebookAccount(accessToken) refresh to the new access token within Playfab for backend calls?
If not, Does LoginWithFacebook(accessToken) refresh the access token?

We'd prefer LinkFacebookAccount because we notice that is just returns without error if the account is already linked anyway. But LoginWithFacebook should work as well.

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

·
Seth Du avatar image
Seth Du answered

Based on the Facebook official documentation, there are two types of Access Tokens and they are short-term token and long-term token. the former will last around 2 hours, and the latter will last for 90 days. When the token is expired, you cannot access Facebook related features on PlayFab (such as FB friend list) and because of it, you have to get a new token from Facebook side for login and etc. However, it doesn't have any effects on the normal usages of PlayFab.

On PlayFab, we simply make use of the access token that user submits, and the token itself defines the expiration date, which means there is barely anything we can do.

You can read through the FB document for example: Refreshing User Access Tokens and I am not sure that PlayFab supports long-lived tokens, but I will dig into it later.

Still, I want you to know that we are not expertise in Facebook thus you can send threads on Facebook Community forum for dedicated assistance.

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.

charlie avatar image charlie commented ·

Thanks. This is my understanding. Therefore, in order for Playfab to be able to continue to use an Access Token, we may need to send you a fresh one (not just extend the current one). For instance, the user may log out which will invalidate the token. Or the user may wait too long to play, which will expire the token.

In these cases, I want to make sure that when I call LinkFacebookAccount(NEW_TOKEN), that Playfab replaces the old token with this one. Then, upon re-login to Facebook, I'll send the new token to you via LinkFacebookAccount.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ charlie commented ·

Yes, LinkFacebookAccount with a new token will replace the old one. I have tested it and it works great for me. In addition, if you are calling LinkFacebookAccount with another player's token, onFail callback will respond.

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.