Update publish.md

Changed authentication Powershell documentation to create an Base64 UTF-8 string
pull/242/head
SMAW 2022-05-07 18:14:01 +02:00 committed by GitHub
parent 7db99d18c7
commit 8d908fe438
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -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"