Reputation: 7056
I have a page on my website where I use the Facebook JS SDK and users click like to reveal a discount code, via a newly created app of mine.
This works fine when you have allowed the app access to your facebook information - but when you haven't, the FB.event.subscribe events do not work.
Also when first coming to the page, no prompt appears for the user to approve the app so all they can see is the like button. The like button will work, but none of the necessary events do (to reveal the code).
Does anyone know why this is?
Upvotes: 0
Views: 49
Reputation: 7056
Managed to figure this out in the end... basically you need to call FB.login(); after init to test whether the user has authenticated your app:
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
} else if (response.status === 'not_authorized') {
FB.login(); //user is logged in but not authed with your app
} else {
FB.login();
}
});
Hope that helps for anyone with the same issue.
Upvotes: 1