我的网络应用程序打开一个窗口,以便通过第三方服务执行OAuth2。登录完成后,第三方服务会将窗口重定向到我的服务器,该服务器将显示以下页面:
<!DOCTYPE html>
<html><head><script>
window.parent.postMessage({someData:123},"*");
</script></head><body></body></html>
redirect_uri与打开原始弹出窗口的页面具有相同的域。但是由于某种原因,postMessage没有通过。但是,当我直接打开redirect_uri而不是第三方登录页面时,postMessage可以正常工作。
只要有问题,这里的第三方服务恰好是Slack。
答案 0 :(得分:0)
window.opener.postMessage而不是window.parent.postMessage