MCPcopy Create free account
hub / github.com/msgbyte/tailchat / login

Method login

apps/github-app/src/client.ts:39–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37 }
38
39 async login() {
40 try {
41 console.log('正在登录...');
42 const { data } = await this.request.post('/api/openapi/bot/login', {
43 appId: this.appId,
44 token: this.getBotToken(),
45 });
46
47 // NOTICE: 注意,有30天过期时间,需要定期重新登录以换取新的token
48 // 这里先不换
49 this.jwt = data.data?.jwt;
50
51 console.log('tailchat openapp login success!');
52
53 // 尝试调用函数
54 // this.whoami().then(console.log);
55 } catch (err) {
56 console.error(err);
57 throw new Error('登录失败, 请检查应用凭证');
58 }
59 }
60
61 async call(action: string, params = {}) {
62 try {

Callers 1

constructorMethod · 0.95

Calls 3

getBotTokenMethod · 0.95
errorMethod · 0.80
logMethod · 0.65

Tested by

no test coverage detected