飞书-企业自建应用

  |  

企业自建应用 嵌入三方网页

配置

  1. 进入https://open.feishu.cn/app?lang=zh-CN

  2. 选择创建自建应用-内容随便

  3. 获取对应的应用凭证
    在这里插入图片描述

  4. 嵌入网页配置
    在这里插入图片描述
    手机端和电脑端可以一样

  5. 在权限关联中授权获取手机号和邮箱
    在这里插入图片描述

应用

  1. 获取 AppAccessToken
    文档: https://open.feishu.cn/document/ukTMukTMukTM/ukDNz4SO0MjL5QzM/auth-v3/auth/app_access_token_internal
1
2
3
4
5
6
7
8
9
10
11
12
const res = await request
.post('https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal')
.set({
'Content-Type': 'application/json; charset=utf-8',
})
.send({
app_id: data.client_id,
app_secret: data.client_secret,
});
const body = res.body;
if (!(body.msg === 'ok' && body.code === 0)) throw new CustomException(-1, '获取app_access_token失败');
const { app_access_token, expire } = body;
  1. 获取用户信息
    文档https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/authen-v1/authen/access_token
1
2
3
4
5
6
7
8
9
10
const res = await request
.post('https://open.feishu.cn/open-apis/authen/v1/access_token')
.set({
'Content-Type': 'application/json; charset=utf-8',
Authorization: `Bearer ${data.access_token}`,
})
.send({
grant_type: 'authorization_code',
code: code,
});
文章目录
  1. 1. 企业自建应用 嵌入三方网页
    1. 1.1. 配置
    2. 1.2. 应用