-
-
Save potomak/7680333 to your computer and use it in GitHub Desktop.
FB.getLoginStatus Object {authResponse: undefined, status: "unknown"} | |
FB.login Object {authResponse: Object, status: "connected"} |
FB.getLoginStatus Object {authResponse: Object, status: "connected"} |
<html> | |
<head> | |
<title>FB.getLoginStatus test</title> | |
</head> | |
<body> | |
<h1>FB.getLoginStatus test</h1> | |
<div id="fb-root"></div> | |
<script> | |
window.fbAsyncInit = function() { | |
// init the FB JS SDK | |
FB.init({ | |
appId : 'YOUR_APP_ID', // App ID from the app dashboard | |
status : true, // Check Facebook Login status | |
xfbml : true // Look for social plugins on the page | |
}); | |
// Additional initialization code such as adding Event Listeners goes here | |
FB.getLoginStatus(function(response) { | |
console.log('FB.getLoginStatus', response); | |
if (response.status === 'connected') { | |
// the user is logged in and has authenticated your | |
// app, and response.authResponse supplies | |
// the user's ID, a valid access token, a signed | |
// request, and the time the access token | |
// and signed request each expire | |
var uid = response.authResponse.userID; | |
var accessToken = response.authResponse.accessToken; | |
} else if (response.status === 'not_authorized') { | |
// the user is logged in to Facebook, | |
// but has not authenticated your app | |
} else { | |
// the user isn't logged in to Facebook. | |
FB.login(function(response) { console.log('FB.login', response); }); | |
} | |
}); | |
}; | |
// Load the SDK asynchronously | |
(function(d, s, id){ | |
var js, fjs = d.getElementsByTagName(s)[0]; | |
if (d.getElementById(id)) {return;} | |
js = d.createElement(s); js.id = id; | |
js.src = "//connect.facebook.net/en_US/all.js"; | |
fjs.parentNode.insertBefore(js, fjs); | |
}(document, 'script', 'facebook-jssdk')); | |
</script> | |
</body> | |
</html> |
FB.getLoginStatus Object {authResponse: undefined, status: "unknown"} | |
FB.login Object {authResponse: Object, status: "connected"} |
I've faced the same problem. Have you reported that issue?
Is this solved somehow?, same problem here :(
Check if you have "3rd party cookies" enabled on your browser (SO thread)
FB.getLoginStatus Object {authResponse: undefined, status: "unknown"}
FB.login Object {authResponse: Object, status: "connected"}
In chrome browser.
I had the same problem for Chromium (I think is the same in Chrome) and found the answer here: Stackoverflow Q&A
Chromium is configured to block third-party cookies and data.
This fixed it for my browser:
- Go to Chrome Settings.
- Show advanced settings...
- Privacy...
- Content settings...
- uncheck Block third-party cookies and site data.
So, be careful if you use FB.getLoginStatus in production. Chrome users might find some problems here.
@jerodb unchecked Block third-party cookies and site data still not working.
Still problem too in 2023 :( Somebody have news about it?
Same happens here, have you submitted this to the bugtracker for Facebook?