Closed tzz-v closed 1 year ago
自己传token的话,需要在构造Client的参数中传递disableTokenCache: true
禁用SDK获取token行为:
const client = new lark.Client({
appId: data.appId,
appSecret: data.appSecret,
disableTokenCache: true
});
class Feishu {
public accessToken = 't-g1041gdxODD4F2FX5VTFKDXFNG3DO24Z5MDPLBBF';
public getChatIdByRobotId() {
return client.im.chat.list({}, lark.withTenantToken(`Bearer ${this.accessToken}`));
}
}
或者也可以使用lark.withUserAccessToken()
来传递自定义token:
const client = new lark.Client({
appId: data.appId,
appSecret: data.appSecret
});
class Feishu {
public accessToken = 't-g1041gdxODD4F2FX5VTFKDXFNG3DO24Z5MDPLBBF';
public getChatIdByRobotId() {
return client.im.chat.list({}, lark.withUserAccessToken(`Bearer ${this.accessToken}`));
}
}
版本:^1.8.1 设置的自定义请求头不起作用