From 86255bf98e91400fbba6b2ca61db9143888890e8 Mon Sep 17 00:00:00 2001 From: MohandL3G Date: Thu, 12 Feb 2026 21:01:07 +0200 Subject: [PATCH] Add header auth to n8n webhook call Introduce header-based authentication for the n8n webhook request by adding $AuthHeaderName and $AuthHeaderValue, constructing a $Headers hashtable, and passing it to Invoke-RestMethod via the -Headers parameter. Keeps the existing payload (status, service, output) and log retrieval; webhook URL is unchanged. --- Update-DockerStacks-n8n.ps1 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Update-DockerStacks-n8n.ps1 b/Update-DockerStacks-n8n.ps1 index 0719d00..eb25f66 100644 --- a/Update-DockerStacks-n8n.ps1 +++ b/Update-DockerStacks-n8n.ps1 @@ -88,13 +88,24 @@ Write-Host "All requested updates finished." -ForegroundColor Cyan Stop-Transcript $LogContent = Get-Content "$env:TEMP\docker_update_log.txt" -Raw -# Send to n8n (Replace the URL with your actual n8n Webhook URL) +# Send to n8n $WebhookUrl = "https://n8n.mohandl3g.ly/webhook/dockerupdater" + +# --- SECURITY CONFIGURATION --- +$AuthHeaderName = "MohandL3G-Auth" +$AuthHeaderValue = "Ms@199903" +# ------------------------------ + +$Headers = @{ + $AuthHeaderName = $AuthHeaderValue +} + $Body = @{ status = "complete" service = "DockerUpdater" output = $LogContent } -Invoke-RestMethod -Uri $WebhookUrl -Method Post -Body ($Body | ConvertTo-Json) -ContentType "application/json" +# Added -Headers parameter here +Invoke-RestMethod -Uri $WebhookUrl -Method Post -Body ($Body | ConvertTo-Json) -ContentType "application/json" -Headers $Headers # --------------------- \ No newline at end of file