Skip to content

Commit

Permalink
fix(Chat Trigger Node): Fix auth in "Embedded Chat" mode (#10734)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegIvaniv authored Sep 9, 2024
1 parent d3861b3 commit 96db501
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 96db501

Please sign in to comment.