fix: 修复DouyinAuthClient方法签名和添加详细调试信息
- 将getAccessToken方法改为async异步方法 - 在构造函数中添加配置和Client创建的调试信息 - 在getAccessToken方法中添加完整的调用流程调试 - 添加try-catch错误处理和详细的错误日志 - 隐藏敏感的clientSecret信息在日志中
This commit is contained in:
parent
d3562b4d36
commit
8eeedb444f
|
|
@ -18,13 +18,29 @@ body:
|
||||||
export class DouyinAuthClient {
|
export class DouyinAuthClient {
|
||||||
private readonly client: Client;
|
private readonly client: Client;
|
||||||
constructor(private config: ConfigService) {
|
constructor(private config: ConfigService) {
|
||||||
|
console.log('DouyinAuthClient constructor - creating client with:', {
|
||||||
|
clientKey: this.config.get('BYTEDANCE_APP_ID') || '',
|
||||||
|
clientSecret: this.config.get('BYTEDANCE_APP_SECRET') ? '***' : 'empty'
|
||||||
|
});
|
||||||
this.client = new Client({
|
this.client = new Client({
|
||||||
clientKey: this.config.get('BYTEDANCE_APP_ID') || '',
|
clientKey: this.config.get('BYTEDANCE_APP_ID') || '',
|
||||||
clientSecret: this.config.get('BYTEDANCE_APP_SECRET') || '',
|
clientSecret: this.config.get('BYTEDANCE_APP_SECRET') || '',
|
||||||
})
|
});
|
||||||
|
console.log('DouyinAuthClient constructor - client created:', !!this.client);
|
||||||
|
console.log('DouyinAuthClient constructor - client.getAccessToken type:', typeof this.client.getAccessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAccessToken() {
|
async getAccessToken() {
|
||||||
return this.client.getAccessToken()
|
console.log('DouyinAuthClient.getAccessToken called');
|
||||||
|
console.log('client:', !!this.client);
|
||||||
|
console.log('client.getAccessToken type:', typeof this.client.getAccessToken);
|
||||||
|
try {
|
||||||
|
const result = await this.client.getAccessToken();
|
||||||
|
console.log('getAccessToken result:', result);
|
||||||
|
return result;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('getAccessToken error:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue