Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
olá pessoal to tentando criar um facebook api só para conhecer mesmo a ferramenta mas travei aqui...
Não consigo add na web o botão de fazer login com facebook.
meu cod verifica se ta logado, se a api tem acesso aos dados do usuario ou se está desconectado.
eu permiti o acesso a api e fiz o login para tentar resgatar meu nome.. mas retornou esse erro:
2500:"An active access token must be used to query information about the current user."
web: http://www.ericrf.host.org/
heroku: https://tranquil-bastion-9726.herokuapp.com/
<!-- FACEBOOK ERF WEB APP -->
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : '440239636037768', // App ID from the App Dashboard
channelUrl : '//www.ericrf.host.org/channel.html', // Channel File for x-domain communication
status : true, // check the login status upon init?
cookie : true, // set sessions cookies to allow your server to access the session?
xfbml : true // parse XFBML tags on this page?
});
function testAPI() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log(response);
console.log('Good to see you, ' + response.name + '.');
});
}
function login() {
FB.login(function(response) {
if (response.authResponse) {
// connected
testAPI();
} else {
// cancelled
}
});
}
testAPI();
// Additional initialization code such as adding Event Listeners goes here
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
// connected
console.debug('conected');
} else if (response.status === 'not_authorized') {
// not_authorized
login();
console.debug('não autorizado');
} else {
// not_logged_in
login();
console.debug('nãologado');
}
});
};
// Load the SDK's source Asynchronously
(function(d, debug){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js";
ref.parentNode.insertBefore(js, ref);
}(document, /*debug*/ false));
</script>channel.html
<script src="//connect.facebook.net/en_US/all.js"></script>
Carregando comentários...