Skip to content

Commit

Permalink
fix(Chat Trigger Node): Fix auth in "Embedded Chat" mode
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegIvaniv committed Sep 9, 2024
1 parent b18313f commit 187f808
Showing 1 changed file with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -460,20 +460,19 @@ export class ChatTrigger extends Node {
const mode = ctx.getMode() === 'manual' ? 'test' : 'production';
const bodyData = ctx.getBodyData() ?? {};

if (nodeMode === 'hostedChat') {
try {
await validateAuth(ctx);
} catch (error) {
if (error) {
res.writeHead((error as IDataObject).responseCode as number, {
'www-authenticate': 'Basic realm="Webhook"',
});
res.end((error as IDataObject).message as string);
return { noWebhookResponse: true };
}
throw error;
try {
await validateAuth(ctx);
} catch (error) {
if (error) {
res.writeHead((error as IDataObject).responseCode as number, {
'www-authenticate': 'Basic realm="Webhook"',
});
res.end((error as IDataObject).message as string);
return { noWebhookResponse: true };
}

throw error;
}
if (nodeMode === 'hostedChat') {
// Show the chat on GET request
if (webhookName === 'setup') {
const webhookUrlRaw = ctx.getNodeWebhookUrl('default') as string;
Expand Down

0 comments on commit 187f808

Please sign in to comment.