首页 > 解决方案 > iframe cust-oauth iframe 命令

问题描述

我正在尝试在网站后端使用 Rocket.Chat 来进行作者之间的交流。我已经让 Rocket.Chat 服务器启动并运行得很好,我的 SSO 可以在网站上正常工作,但是,我在后端特定页面的 iframe 中使用 Rocket.Chat,而我想要让它尝试自动登录,因为个人已经登录到他们的 SSO 以到达那里。我在使用 iframe auth 命令“call-custom-oauth-login”时遇到问题。这是我的代码片段,不确定我做错了什么或者我是否缺少参数。

<iframe width='100%;' id="iframeId" onload="authenticateIFrame()" height='100%' src="https://myrocketchatdomain.com/channel/general" frameborder="0" SameSite=none onmousewheel="" style="background: transparent;"></iframe> `

`function authenticateIFrame() {
    document.getElementById('iframeId').contentWindow.postMessage({
        externalCommand: 'call-custom-oauth-login',
        service: 'test'
    }, '*');
}

“测试”是我在 Rocket.Chat 中创建的 oAuth 的名称,是的,我在 Rocket.Chat 的后端启用了 iFrame 作为 externalCommand: 'logout' 效果很好。

任何帮助都会非常有用,我一直在努力解决这个问题哈哈

标签: rocket.chat

解决方案


推荐阅读