【发布时间】:2016-03-15 03:00:25
【问题描述】:
您好 Stackoverflow 社区,我在使用 Meteor 的 google 登录时遇到问题。
登录流程在 localhost 中运行良好,但在部署中却不行。
我在 Meteor 的控制台上收到以下错误:
Exception while invoking method 'login' Error: Failed to complete OAuth handshake with Google. failed [400] { "error" : "redirect_uri_mismatch" }
at getTokens (packages/google/google_server.js:59:1)
at Object.ServiceConfiguration.configurations.findOne.service [as handleOauthRequest] (packages/google/google_server.js:10:1)
at OAuth._requestHandlers.(anonymous function) (packages/oauth2/oauth2_server.js:8:1)
at middleware (packages/oauth/oauth_server.js:173:1)
at packages/oauth/oauth_server.js:146:1
这是我当前的故障排除清单:
1.- 使用 loginStyle 'popup' 更正 db.meteor_accounts_loginServiceConfiguration 上的客户端 ID 和客户端密码
2.- 当弹出窗口打开时,redirect_uri 设置为正确的端点 (http://example.com/_oauth/google)。
3.- 在谷歌控制台上的应用重定向上授权的重定向 uri
我的观察之一是,如果将 loginStyle 更改为重定向而不是弹出窗口,在 google oauth 重定向到我的 redirect_uri 后,我的 redirect_uri 再次重定向到 localhost 而不是经典的 */_oauth/google 窗口(登录完成。点击这里关闭此窗口。)
编辑 出现的另一个错误是:
Error in OAuth Server: redirectUrl (http://example.com/users) is not on the same host as the app (http://localhost:80/)
所以应用程序拒绝了redirectUrl(该域对我的亚马逊ec2实例的弹性IP有一个A记录),我在端口80上运行仅用于测试目的
【问题讨论】:
标签: meteor oauth google-oauth meteor-accounts