【发布时间】:2017-06-17 23:22:07
【问题描述】:
一些像api exploer这样的谷歌网站使用mixed scheme而不是重定向到一个URI,在这个URI中,postmessage事件是由来自opener window的回调函数触发的,该回调函数由opener window接收(所以window.location.origin与window.origin 不同,但我不明白如何)。
我找不到有关它的文档,但也许我搜索不正确。
主要优势似乎不需要服务器端令牌注册,因为一切都通过 JavaScript 发生。
Here’s <a href='javascript:window.open("https://accounts.google.com/o/oauth2/auth?client_id=292824132082.apps.googleusercontent.com&immediate=false&scope=https://www.googleapis.com/auth/userinfo.email&include_granted_scopes=false&proxy=oauth2relay604084667&redirect_uri=postmessage&origin=https://apis-explorer.appspot.com&response_type=token&gsiwebsdk=1&state=657454173|0.195379257&authuser=0&jsh=m;/_/scs/apps-static/_/js/k");'>an example script link</a> that will trigger a Domexception if not opened from https://apis-explorer.appspot.com/
此外,http://accounts.google.com/o/oauth2/auth 访问
window.opener 子元素,如果 window.opener.origin 匹配原点参数
在 url 中给出,因此绕过了 sop (但我不明白为什么没有使用 Acess-control-Allow-* 标头)。否则会触发异常。
那么使用 postmessage 执行 oauth2 身份验证的 JavaScript api 是什么? proxy= url 参数的作用是什么?
【问题讨论】:
标签: javascript authentication google-signin google-oauth