0
我正在使用Parse.com並試圖實現他們的Facebook登錄功能。我有下面的代碼,當我加載頁面時,Facebook對話框彈出並立即關閉。沒有給出成功或錯誤消息。解析Facebook登錄 - Javascript對話框
<body>
<div id="fb-root"></div>
<script type="text/javascript">
//Initialize Parse SDK
Parse.initialize('xxx',
'xxx');
window.fbAsyncInit = function() {
//Initialize Facebook SDK via Parse
Parse.FacebookUtils.init({
appId : 'xxx',
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?
});
// use Parse SDK to show Facebook login box on page load
Parse.FacebookUtils.logIn(null, {
success: function(user) {
if (!user.existed()) {
alert("User signed up and logged in through Facebook!");
} else {
alert("User logged in through Facebook!");
}
},
error: function(user, error) {
alert("User cancelled the Facebook login or did not fully authorize.");
}
});
};
// Load the SDK's source 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>