流星1.3+帐户Facebook登录iOS无法正常工作

时间:2016-10-08 19:58:27

标签: javascript facebook meteor meteor-accounts

我一直试图找到一个解决方案(遗憾的是现在3个月)使用iOS上的Meteors Accounts Facebook登录Facebook。我已经尝试了谷歌搜索提出的所有内容,在Meteor论坛上进行了讨论,甚至打开了Github问题。

但是这个问题仍然让我感到厌烦。一切都在桌面上工作正常,但是当我在手机上测试时,我得到Facebook错误&#34;未登录。您尚未登录。请登录并再试一次&#34; 。< / p>

我找到了其他几个关于这个问题的人,并且在完整的证据答案中输入的内容很少。在这一点上,我开始变得绝望。

在Meteor升至1.3之前,这不是一个问题。

enter image description here

4 个答案:

答案 0 :(得分:1)

通过以下设置为我工作

  1. 最新版本的Meteor和Xcode
  2. 与帐户相关的流星套餐

    accounts-base
    accounts-password
    accounts-facebook
    accounts-google
    useraccounts:materialize 
    service-configuration
    accounts-ui
    splendido:accounts-meld
    
  3. 使用

    渲染模板
    {{> atForm}}
    
  4. 我还添加了2个cordova插件(用于在.meteor文件夹中创建名为cordova-plugins的文件以及以下内容

    cordova-plugin-meteor-webapp@https://github.com/meteor/cordova-plugin-meteor-webapp.git#8bf95eed3f313299fc2de33658866278eea2cdc5
    cordova-plugin-inappbrowser@https://github.com/apache/cordova-plugin-inappbrowser.git#2df0e72c36f1fda35c04b3b06bd7beaafaae6ee9
    
  5. 还要确保在html的head标记中包含以下行

    <meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline' 'unsafe-eval' data: " />
    
  6. 最后在mobile-config.js文件中添加以下行

    App.accessRule('http://*', {type: 'navigation'});
    App.accessRule('https://*', {type: 'navigation'});
    
  7. 在构建

    之前也运行meteor reset命令

答案 1 :(得分:0)

这可能是GitHub issues

中的问题
  

根据author - 似乎iOS 10中的WKWebView不再将Meteor Cordova CSP(default-src *)应用于websockets,并使用以下消息阻止连接。当用户更新到iOS 10 时,这会破坏生成websocket连接的生产应用程序 (可能只有默认连接到Meteor服务器以外的连接?不确定) (已经发布)。

问题在于代码行

<meta http-equiv="Content-Security-Policy" content="default-src * data: blob: 'unsafe-inline' 'unsafe-eval';">

您可以尝试通过

替换它
<meta http-equiv="Content-Security-Policy" content="default-src * 'self' data: blob: 'unsafe-inline' 'unsafe-eval' wss://*.ourdomain.tld ">

在文件https://github.com/meteor/meteor/blob/master/packages/boilerplate-generator/boilerplate_web.cordova.html

然后运行meteor update boilerplate-generator

更新Meteor 1.4

您还可以尝试按照

链接中的说明更新meteor update --release 1.4.2-beta.4
  

此包在构建过程中运行,在项目级别更新此包不会更改用于构建应用程序的文件。

此外,如果它仍然无效,则按照此author

的建议

您可以添加一个简单的插件meteor add cordova:meteor-ios10-csp-fix@0.1.0

回购是here,npm页面是here

希望这有帮助。

完全归属于github链接以及上面提到的作者

答案 2 :(得分:0)

为了让我能够工作,我升级到最新版本的meteor,accounts-facebook等。

接下来,我使用facebook登录部署了该应用程序的Web版本。然后我测试了web app facebook登录。一旦在您的Facebook应用设置中添加了有效的oauth重定向URI,一切都很好。这些应该类似于https://example.com

然后我在终端if __main__

中跑了

我的mobile-config.js文件也包含@Afzal Hossain的推荐 meteor run ios-device --settings settings.json --mobile-server https://example.com

我的设备上的应用程序用于登录。

不再需要cordova插件或CSP策略,因为流星更新使这些不必要。

答案 3 :(得分:0)

我通过在Facebook App&#34;有效OAuth重定向URI&#34;中指定正确的Url来解决同样的问题。

早些时候,我指定了 http://<domainname>/_oauth/facebook?close

哪个不起作用。经过一些调试,我发现URL应该是

http://<domainname>:<port>/_oauth/facebook?close(带端口号)

因此,如果服务器在http://localhost:3000上运行,则为http://<device ip/external ip>:3000/_oauth/facebook?close

并且,如果您使用--server = http://www.domainname.com运行应用程序,那么它将是http://www.domainname:80/_oauth/facebook?close(HTTP的端口80)

现在,我看到了Facebook App登录页面,可以登录。

但是现在我很难在身份验证后关闭InAppBrowser。在这方面的任何帮助都会很棒!

相关问题