google Oauth在https服务器中登录 [英] google Oauth login in https server
问题描述
我在Https服务器上有一个流星Web服务器,说https://popasdesasdasd.com
.
我将此网址添加到Javascript Origin uri和https://popasdesasdasd.com/_oauth/google?close
重定向uri中.
I have an meteor web server on Https server say https://popasdesasdasd.com
.
I added this url to the Javascript Origin uri and https://popasdesasdasd.com/_oauth/google?close
in redirect uri.
在请求时,它说uri不匹配,并要求将http://popasdesasdasd.com/_oauth/google?close
放在重定向uri中.
On request, it says mismatch uri and asked to put http://popasdesasdasd.com/_oauth/google?close
in redirect uri.
添加后,我会得到
未捕获到的SecurityError:阻止了具有原点的帧 ' http://popasdesasdasd.com '",因为它访问的是原始帧 ' https://popasdesasdasd.com '". 请求访问的帧的协议为"http", 被访问的帧的协议为"https".协议必须匹配.
Uncaught SecurityError: Blocked a frame with origin "'http://popasdesasdasd.com'" from accessing a frame with origin "' https://popasdesasdasd.com'". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "https". Protocols must match.
我该如何解决?
推荐答案
确保您的ROOT_URL环境变量也使用https://
.一个没有http s 的原因是您的说明说要在Google的api控制台上使用http://popasdesasdasd.com/_oauth/google?close
作为您的重定向uri的原因.
Make sure your ROOT_URL environment variable uses https://
too. The one without https is the reason your instructions said to use http://popasdesasdasd.com/_oauth/google?close
as your redirect uri on Google's api console.
此外,请确保将https://popasdesasdasd.com/_oauth/google?close
设置为您的重定向URI.您将必须更正已经使用过的那个.
Also, make sure https://popasdesasdasd.com/_oauth/google?close
is set to your redirect URI. You would have to correct the one you've already used.
如果您使用的是iframe,则可能会遇到问题,您需要遵循一种协议. force-ssl
程序包可以帮助重定向所有用户以使用SSL:
If you're using an iframe this is likely to be an issue you you will need to stick to one protocol. The force-ssl
package can help redirect all users to use SSL:
meteor add force-ssl
(请注意,如果您在VM上进行测试,这将在本地带来困难,特别是如果您使用Windows并且VM是独立的)
(Note this will make it difficult locally if you test on a VM, particularly if you use windows and the VM is seperate)
这篇关于google Oauth在https服务器中登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!