admin管理员组

文章数量:1531293

本人环境(php7、laravel5),为响应公司要求,内部自研信息系统集成到飞书工作台后,点击工作台应用可支持飞书指定设置浏览器单点登录。

第一步:设置飞书客户端默认浏览器;

第二步:配置飞书自建应用,开启网页应用功能,设定好跳转URL、安全设置配置URL重定向;

第三步:在接口中调用 window.open() 函数,实现新窗口打开效果即可。 
echo '<script>window.open("http://www.assets:81/Home", "_blank", "resizable,scrollbars,status");</script>';
exit();

 备注:如觉得每次单点都得授权麻烦,可以新建个接口中转一下

/**
 * 单点登录资产系统
 */
 public function clickSystemLogin(){
    //飞书PC端
    if (strpos($_SERVER['HTTP_USER_AGENT'],'Electron/Native WebApp/workplace')!== false){ 
        echo '<script>window.open("http://www.baidu/clickSystemLoginViews", "_blank", "resizable,scrollbars,status");</script>';
        dd();
    }else{
        return redirect("assets");
        exit();
    }
 }


/*
 * 飞书单点中转函数
 */
 public function clickSystemLoginViews(){
     if (Session::get('loginUserEmployeeNo')){
         return redirect('Home');
         exit();
     }
     if (Session::get('SYSTEM_AUTH')==1){
         return redirect('SystemNew');
         exit();
     }

     $url = "Location: https://open.feishu/open-apis/authen/v1/index?redirect_uri=redirect_uri&app_id=app_id=assetSystem";
     header($url);
     dd();
 }

本文标签: 如何实现浏览器PC