Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by max · Jan 06, 2018 at 09:01 PM · CloudScriptFriends

Cloud Script GetFriendsList - Facebook Token expired - How to check?

We're currently have the issue that we didn't know that we need need update the User's Facebook token from time to time in order to be able to get their Friend List with Facebook friends.

Therefore, currently one of our Cloud Script calls is crashing with this error

"errorMessage": "(OAuthException - #190) Error validating access token: Session has expired on Friday, 05-Jan-18 07:01:29 PST. The current time is Saturday, 06-Jan-18 11:36:02 PST.",

A few questions about that:

1) What is the designated way to update the Facebook Token, is it calling LoginFacebook from time to time?

2) The error code for this is 1143 (so the standard facebook API error according to the PlayFabError.h in our C++ Client SDK). Are the PlayFab error codes available in Cloud Script, so we can check for them? Or should we manually define all the error codes that we need?

3) Can we somehow check if the Facebook Token is outdated in CloudScript? Or do we need to waste an API Call with a try/catch to see if GetFriends will return an error?


Thanks for taking the time to help :)

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Brendan · Jan 06, 2018 at 11:16 PM

Yes, our ability to make calls to Facebook on behalf of the user depends upon us having a current token. Facebook will not provide a token with no expiration in this scenario, so you need to periodically use LoginWithFacebook to update us. For most games, just doing that at the start of the player's session is all you need.

In Cloud Script, what you'll want to do is use a try/catch to be able to evaluate the error that occurred and take any additional action based upon it.

Unfortunately, there isn't a way to check the token from Facebook to see if it is current. But in general, service tokens tend to last for hours, so for most games, this should rarely be an issue.

Comment

People who like this

0 Show 10 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image max · Jan 06, 2018 at 11:18 PM 0
Share

Okay cool thanks, so 1) and 3) are answered. :)

How about 2) and the erorr constants in Cloud Script? ;)

avatar image Brendan ♦♦ max · Jan 07, 2018 at 04:01 AM 0
Share

Well first, yes, the error you capture in the try/catch will have all the error details, which you can parse and use. However, I do need to point out that if you make a call to GetFriendsList for a player using a valid PlayFab ID, it will successfully return the friends for that player. If you happen to specify IncludeFacebookFriends for a player who doesn't have an up-to-date token, it still successfully returns what it can - it does not return an error.

avatar image max Brendan ♦♦ · Jan 07, 2018 at 04:09 AM 0
Share

Thanks. Okay first. I know that I can parse and use the erorr - sorry if I was unclear. I was wondering if all the PlayFab Error constants would be actually present in the Cloud Script environment. Like 'server' is a global variable, maybe also all the error codes are? Or do we have to just check with the error code pure numbers and there are no global variables set up for that?

Second, if the GetFriendsList call is meant to return even if the Facebook token is invalid...then this might a bug, since it does return an error for us in this case. I've sent you our Title ID and CloudScript event ID privately in the Community slack channel if you want to have a look.

I also recently reported the friend-tag-profile-constraints-bug (https://community.playfab.com/questions/16200/server-api-possible-bug-you-only-get-friend-tags-w.html) of GetFriendList - so maybe this might be not the only one?

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    3 People are following this question.

    avatar image avatar image avatar image

    Related Questions

    C#/UWP: AddFriend per Cloud Script fails 5 Answers

    Cloud script Friends GetPlayerStatistics vs GetFriendLeaderboard considering request limit 1 Answer

    "Internal Server Error" in GetFriendLeaderboard API 0 Answers

    How to manage Friend list manually without errors and API request limit 1 Answer

    Tags does not show in GetFriendLeaderboard 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges