简体   繁体   English

使用解析Javascript SDK的Facebook登录错误

[英]Facebook Login Error Using Parse Javascript SDK

I'm trying to log into Facebook via Parse in a PhoneGap project made for Android. 我正在尝试通过为Android开发的PhoneGap项目中的Parse登录Facebook。

When I try to run the HTML locally, the pop-up will appear but I get the generic "an error occurred" message. 当我尝试在本地运行HTML时,将出现弹出窗口,但我收到通用的“发生错误”消息。 When I run the Android project, the Facebook pop-up/redirect won't even appear. 当我运行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>

So, I'd love to get this working. 所以,我很想让这个工作。 Thanks in advance for any help! 在此先感谢您的帮助! :) :)

Update - This is the error information I get: 更新-这是我得到的错误信息:

API Error Code: 191 API Error Description: The specified URL is not owned by the application Error Message: Invalid redirect_uri: Given URL is not allowed by the Application configuration. API错误代码:191 API错误描述:应用程序不拥有指定的URL错误消息:无效的redirect_uri:应用程序配置不允许给定的URL。

Did you ever find a complete solution for this? 您是否找到了完整的解决方案? I can get around your specific problem by selecting Website with Facebook Login as how my app integrates with Facebook, and setting the website to [http://localhost]. 通过选择使用Facebook登录的网站作为我的应用程序与Facebook的集成方式,并将网站设置为[http:// localhost],可以解决您的特定问题。 which then works fine within Chrome running off a local server, but then doesn't work on an actual device with the error "The Javascript Facebook SDK must be loaded before calling init" in the Parse JS SDK. 然后在运行本地服务器的Chrome上可以正常运行,但随后在实际设备上无法正常工作,并且在Parse JS SDK中出现错误“在调用init之前必须加载Javascript Facebook SDK”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM