https://open.feishu.cn/document/common-capabilities/sso/web-application-sso/qr-sdk-documentation
<script src="https://sf3-cn.feishucdn.com/obj/static/lark/passport/qrcode/LarkSSOSDKWebQRCode-1.0.1.js"></script>
<div id="login_container"></div>
mounted() {
var QRLoginObj = QRLogin({
id:"login_container",
goto: "https://passport.feishu.cn/suite/passport/oauth/authorize?client_id=cli_a03f23493d39d00e&redirect_uri=https%3A%2F%2Fwww.baidu.com&response_type=code&state=STATE",
width: "500",
height: "500",
});
var handleMessage = function (event) {
var origin = event.origin;
// 使用 matchOrigin 方法来判断 message 是否来自飞书页面
if( QRLoginObj.matchOrigin(origin) ) {
var loginTmpCode = event.data;
// 在授权页面地址上拼接上参数 tmp_code,并跳转
//window.location.href = `${goto}&tmp_code=${loginTmpCode}`;
console.log(loginTmpCode)
}
};
if (typeof window.addEventListener != 'undefined') {
window.addEventListener('message', handleMessage, false);}
else if (typeof window.attachEvent != 'undefined') {
window.attachEvent('onmessage', handleMessage);
}
},