问题描述
我正在尝试设置我的 Meteor 应用程序以使用 Google 登录,这是我在/server/config.js 文件中的设置
I am trying to setup my Meteor app to use Google logins,Here is my setup in the /server/config.js file
Accounts.loginServiceConfiguration.remove({
service: "google"
});
Accounts.loginServiceConfiguration.insert({
service: "google",
clientId: "XXXXXXX",
secret: "XXXXXX"
});
我在 google 上设置指向 localhost:3000我的meteor 应用程序上安装了accounts-ui 和accounts-google.
I have the setup on google pointed to localhost:3000I have accounts-ui and accounts-google installed on my meteor app.
我在我的应用主页上看到了谷歌登录按钮,但当我点击它时,我得到:
and I see the google login button on my app's homepage but when I click it I get:
Error: redirect_uri_mismatch The redirect URI in the request:
http://localhost:3000/_oauth/google?close
did not match a registered redirect URI
推荐答案
我正在使用 Nitrous.io,因为我是在 Windows 上开发的.这篇文章解释了为什么 google 看到错误的 URI.
I'm using Nitrous.io since I am developing on Windows. This article explains why google sees the wrong URI.
https://github.com/shoebappa/vagrant-meteor-windows/问题/9
基本上,您需要使用修改后的 ROOT_URL 启动meteor,这样它就不会以 localhost 开头.
Basically you need to launch meteor with a modified ROOT_URL so that it doesn't start with localhost.
用流星实际运行的 URL 替换 localhost.meteor.com.ROOT_URL=http://localhost.meteor.commeteor
Replace localhost.meteor.com with the URL that meteor is actually running at.ROOT_URL=http://localhost.meteor.com meteor
这篇关于Meteor.js Google Oauth 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!