Login     Sign up
facebook module
HometownDirectories (@danyaeldemonic)
Join date: Oct 31st 2011
Community posts: 39
View Profile
Send Message

I've created the app, got the ID & secret, but when my users click on the FB login button I still keep getting

Warning: file_get_contents(https://graph.facebook.com/me?) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in /home/danyael/public_html/hometown-directories.com/modules/fblogin/fblogin.php on line 63
bad fb token

152 months ago
Jesreel (@vfmultimedia)
Join date: Nov 10th 2011
Community posts: 2
View Profile
Send Message

FB.login prompts the user to authorize your application.

Example

FB.login(function(response) {
if (response.authResponse) {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log('Good to see you, ' + response.name + '.');
FB.logout(function(response) {
console.log('Logged out.');
});
});
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, {scope: 'email'});

This example shows the correct way to ask for permissions when the Javascript SDK has been initialized with OAuth 2.0 enabled. Without OAuth 2.0, scope should instead be replaced with perms, and response.authResponse replaced with response.session. Remember that all apps must migrate to OAuth 2.0 by October 1, 2011.

Best Practices

FB.login opens a popup window, and therefore you should only call FB.login when bound to a user driven click. Most browsers block popups, unless they were initiated from a user event, such as a click on a button or a link.

Depending on your app's needs, you may need additional permissions from the user. You can request additional permissions at any time by using FB.login and specifying the additional permissions required.

Our data indicate that a large number of permissions decreases the conversion rate -- therefore, we advise requesting as few as possible.

Parameters

Name. Type Description
cb Function The callback function.
opts Object (optional) Options to modify login behavior.
Name Type Description
scope String. Comma separated list of Extended permissions

152 months ago
Jesreel (@vfmultimedia)
Join date: Nov 10th 2011
Community posts: 2
View Profile
Send Message

This example I got from the facebook.com/developers FB Login

152 months ago
HometownDirectories (@danyaeldemonic)
Join date: Oct 31st 2011
Community posts: 39
View Profile
Send Message

anyone else had this happen? FB help section is no help in this case

152 months ago
Prev 1 2