Meteor.js Google Oauth问题

gla*_*ses 14 oauth meteor

我正在尝试设置我的Meteor应用程序以使用Google登录,这是我在/server/config.js文件中的设置

Accounts.loginServiceConfiguration.remove({
service: "google"
  });


Accounts.loginServiceConfiguration.insert({
service: "google",
clientId: "XXXXXXX",
secret: "XXXXXX"
  });
Run Code Online (Sandbox Code Playgroud)

我在谷歌的设置指向localhost:3000我在我的流星应用程序上安装了帐户-ui和accounts-google.

我在我的应用程序主页上看到谷歌登录按钮,但当我点击它时,我得到:

Error: redirect_uri_mismatch The redirect URI in the request: 
http://localhost:3000/_oauth/google?close 
did not match a registered redirect URI
Run Code Online (Sandbox Code Playgroud)

Jos*_*Joe 7

我正在使用Nitrous.io,因为我在Windows上开发.本文解释了为什么谷歌会看到错误的URI.

https://github.com/shoebappa/vagrant-meteor-windows/issues/9

基本上你需要使用修改后的ROOT_URL启动meteor,这样它就不会以localhost启动.

将localhost.meteor.com替换为meteor实际运行的URL.ROOT_URL = http://localhost.meteor.com流星


hkn*_*ust 6

您必须使用Google的API控制台注册重定向网址.登录到控制台并检查已设置的重定向URI.必要时添加localhost

更新:

我自己试了一下并加了

 http://localhost:3000/_oauth/google?close 
Run Code Online (Sandbox Code Playgroud)

在API控制台中.我将account-google和accounts-ui添加到Hello World应用程序中,并将登录按钮添加到页面中

<body>
    {{loginButtons}}
    {{> hello}}
</body>
Run Code Online (Sandbox Code Playgroud)

我同意弹出窗口中的请求权限并已登录.