mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(Chat Trigger Node): Fix auth in "Embedded Chat" mode (#10734)
This commit is contained in:
@@ -460,20 +460,19 @@ export class ChatTrigger extends Node {
|
|||||||
const mode = ctx.getMode() === 'manual' ? 'test' : 'production';
|
const mode = ctx.getMode() === 'manual' ? 'test' : 'production';
|
||||||
const bodyData = ctx.getBodyData() ?? {};
|
const bodyData = ctx.getBodyData() ?? {};
|
||||||
|
|
||||||
if (nodeMode === 'hostedChat') {
|
try {
|
||||||
try {
|
await validateAuth(ctx);
|
||||||
await validateAuth(ctx);
|
} catch (error) {
|
||||||
} catch (error) {
|
if (error) {
|
||||||
if (error) {
|
res.writeHead((error as IDataObject).responseCode as number, {
|
||||||
res.writeHead((error as IDataObject).responseCode as number, {
|
'www-authenticate': 'Basic realm="Webhook"',
|
||||||
'www-authenticate': 'Basic realm="Webhook"',
|
});
|
||||||
});
|
res.end((error as IDataObject).message as string);
|
||||||
res.end((error as IDataObject).message as string);
|
return { noWebhookResponse: true };
|
||||||
return { noWebhookResponse: true };
|
|
||||||
}
|
|
||||||
throw error;
|
|
||||||
}
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
if (nodeMode === 'hostedChat') {
|
||||||
// Show the chat on GET request
|
// Show the chat on GET request
|
||||||
if (webhookName === 'setup') {
|
if (webhookName === 'setup') {
|
||||||
const webhookUrlRaw = ctx.getNodeWebhookUrl('default') as string;
|
const webhookUrlRaw = ctx.getNodeWebhookUrl('default') as string;
|
||||||
|
|||||||
Reference in New Issue
Block a user