Ale*_*ter 6 facebook oauth meteor nitrousio
更新: 当我将应用程序部署到meteor.com时,我没有遇到任何相同的问题,所以问题肯定与开发环境有关,我怀疑与ROOT_URL和处理重定向的方式有关.
我在Nitrous.io上运行Meteor .
我已经安装了accounts-facebook包并将以下内容添加到服务器文件夹中:
ServiceConfiguration.configurations.remove({
service: "facebook"
});
ServiceConfiguration.configurations.insert({
service: "facebook",
appId: '31058319242*****',
secret: '4f6c8a9b5aab235111e97*********',
site_url: 'http://accounts-*****.apse2.nitrousbox.com/'
});
Run Code Online (Sandbox Code Playgroud)
我还在启动时更改了我的应用程序的根URL:
Meteor.startup(function () {
Meteor.absoluteUrl.defaultOptions.rootUrl = "http://accounts-*****.apse2.nitrousbox.com/"
});
Run Code Online (Sandbox Code Playgroud)
我在应用的"基本"设置中包含了完全相同的网址:

和'高级'设置:

[显然,*****实际上是一个识别我的Nitrous'盒子的字符串' - 我在这里编辑了它]
但是,当我尝试授权使用Facebook时,我收到以下错误:
Exception while invoking method 'login' Error: Failed to complete OAuth handshake with Facebook. failed [400]
{
"error":
{
"message":"Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
"type":"OAuthException",
"code":191
}
}
Run Code Online (Sandbox Code Playgroud)
我在这些设置上尝试了许多不同的变体,但没有成功.
还有其他人遇到过这个问题吗?帮助赞赏.
小智 10
问题是ROOT_URL未设置为框的URL.=> App running at: http://localhost:3000/当您使用meteor命令启动应用程序时,您会注意到终端输出仍然显示.
Meteor.absoluteUrl只是一个实用功能(https://github.com/meteor/meteor/issues/858).ROOT_URL启动应用程序时需要覆盖环境变量.
尝试启动应用程序ROOT_URL=http://accounts-*****.apse2.nitrousbox.com/ meteor.然后,Facebook身份验证过程应该正常工作.