I am trying to check if a user is logged in with my app, but I am getting a
FB.getLoginStatus() called before calling FB.init().
You need to load the api asynchronously. Try removing your and updating your JS to:
Oh and check the documentation!