[英]Facebook Login Error Using Parse Javascript SDK
我正在嘗試通過為Android開發的PhoneGap項目中的Parse登錄Facebook。
當我嘗試在本地運行HTML時,將出現彈出窗口,但我收到通用的“發生錯誤”消息。 當我運行Android項目時,Facebook彈出/重定向甚至都不會出現。
<script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"></script>
<script src="http://www.parsecdn.com/js/parse-1.0.8.min.js"></script>
<script>
Parse.initialize("XXXXXXX",
"YYYYYY");
</script>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
Parse.FacebookUtils.init({
appId : 'ZZZZZZZ', // App ID
channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional initialization code here
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 Asynchronously
(function(d){
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.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
<h1>Hello World</h1>
</body>
</html>
所以,我很想讓這個工作。 在此先感謝您的幫助! :)
更新-這是我得到的錯誤信息:
API錯誤代碼:191 API錯誤描述:應用程序不擁有指定的URL錯誤消息:無效的redirect_uri:應用程序配置不允許給定的URL。
您是否找到了完整的解決方案? 通過選擇使用Facebook登錄的網站作為我的應用程序與Facebook的集成方式,並將網站設置為[http:// localhost],可以解決您的特定問題。 然后在運行本地服務器的Chrome上可以正常運行,但隨后在實際設備上無法正常工作,並且在Parse JS SDK中出現錯誤“在調用init之前必須加載Javascript Facebook SDK”。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.