How do I get Facebook User ID?

  • So I have a Facebook log in on my game. it allows the user to log into my game via FB and stores their information into different variables. So the information I'm currently trying to retrieve is their name and User ID. I can retrieve the name, store into a variable, and display the name via text object no problem. However when i try to store the User ID and display it all I get is NaN. Now if I refresh my game then the User ID will show up fine. But on the first Log in the User ID always comes in as NaN. Anyone else have this issue?

  • it may take sometime before it connects to the server, you should also check for "is user logged in"

  • I've tried it with, On User Log in and Is user logged in still keep getting NaN on the first login. I even tried creating a variable LoggedIn = 0. And upon logging in it changes to 1 and then having another event that says if LoggedIn = 1 then set FBUserID to Facebook.UserID. Still get a NaN result. I've also tried setting it up so that EveryTick FBUserID = Facebook.UserID. That doesn't even work so it's like the User ID isn't even being passed on the first log in whatsoever.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I haven't made any progress on this and was hoping someone out there has figured out how to store the Facebook User ID into a variable upon first login.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)