Hello ! I’m trying to send a message with my extension’s EBS and I need some help !
I think I’m doing it right :
generateJwt(channelId: string): string
{
const payload: EbsJwt = {
exp:Math.floor(Date.now() / 1000) + (60 * 60),
user_id: '656175601',
channel_id: channelId,
role: 'external'
}
return jwt.sign(payload, Buffer.from(secret, 'base64'), { algorithm: 'HS256' });
}
async sendChatMessage(channelId:string, message:string){
const url = twitchApiConfig.url.endpoints.twitchChat + channelId;
try {
// Perform POST Request
await superAgent
.post(url)
.send({text:message, extension_id:secretInformation.clientId, extension_version:'0.0.1'})
.set('Client-ID', secretInformation.clientId)
.set('Authorization', 'Bearer ' + this.authService.generateJwt(channelId))
.set('Content-Type', 'application/json');
} catch (error) {
console.log(JSON.stringify(error.response));
}
}
I always get this error :
status:401,message:missing authorization argument
Every secret and needed information is already good and wworking in other parts of my project.
Can anyone help ?
Thanks !