我有一个Ubuntu 14.04服务器,我有一个流星应用程序在此服务器上运行localhost:3000
。我的服务器的公共FQDN是sub.example.com
。流星应用程序使用谷歌的OAuth 2.0,我有以下的谷歌API控制台配置:Nginx代理与谷歌OAuth 2.0
URI REDIRECTION
http://sub.example.com/_oauth/google
http://sub.example.com/_oauth/google?close
ORIGINES JAVASCRIPT
http://sub.example.com
我的Nginx的配置文件看起来是这样的:
server {
listen 80 default_server;
server_name sub.example.com www.sub.example.com;
location/{
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:3000;
}
}
代理的作品,我可以访问我的流星申请当我去sub.example.com
。但是,当这个应用程序,我尝试使用谷歌的OAuth 2.0,弹出打开,因为它应该和我得到:
Error: redirect_uri_mismatch
The redirect URI in the request: http://localhost:3000/_oauth/google?close did not match a registered redirect URI.
我打,在没有运气nginx的配置文件中的标题。
我明显错过了一些东西。
您正在发送来自http:// localhost:3000/_oauth/google?的请求,并将其放在重定向uri中。在云端控制台上。 – DaImTo 2015-02-23 13:31:18
据我了解,这是行不通的,因为用户浏览器无法访问服务器的本地主机。但是,如果流星应用程序在我的笔记本电脑上,我可以做到这一点,它的工作。谢谢。 ' – mthpvg 2015-02-23 22:19:32