From 8d908fe438ac3358af50d54ae3e50b2f02b88d5c Mon Sep 17 00:00:00 2001 From: SMAW Date: Sat, 7 May 2022 18:14:01 +0200 Subject: [PATCH] Update publish.md Changed authentication Powershell documentation to create an Base64 UTF-8 string --- docs/publish.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/publish.md b/docs/publish.md index c9971fa0..a63c61bb 100644 --- a/docs/publish.md +++ b/docs/publish.md @@ -2504,9 +2504,11 @@ Here's a simple example: === "PowerShell" ``` powershell $uri = "https://ntfy.example.com/mysecrets" - $headers = @{ Authorization="Basic cGhpbDpteXBhc3M=" } - $body = "Look ma, with auth" - Invoke-RestMethod -Method 'Post' -Uri $uri -Body $body -Headers $headers -UseBasicParsing + $credentials = 'username:password' + $encodedcredentials = [convert]::ToBase64String([text.Encoding]::UTF8.GetBytes($Credentials)) + $headers = @{Authorization="Basic $encodedcredentials"} + $message = "Look ma, with auth" + invoke-RestMethod -Uri $uri -Body $message -Headers $headers -Method "Post" -UseBasicParsing ``` === "Python"