Explorar o código

Update publish.md (PowerShell 7+ Access Token Example)

Corrected PowerShell 7+ Parameter from Authorization to Authentication
Converted Token text to SecureString Inline - token must be of type SecureString
Added comment noting the Token parameter must be a SecureString
Patrick hai 1 ano
pai
achega
763eafd5dd
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      docs/publish.md

+ 4 - 2
docs/publish.md

@@ -3136,11 +3136,13 @@ with the token `tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2`:
 === "PowerShell 7+"
 === "PowerShell 7+"
     ``` powershell
     ``` powershell
     # With PowerShell 7 or greater, we can use the Authentication and Token parameters
     # With PowerShell 7 or greater, we can use the Authentication and Token parameters
+    # The Token parameter must be in the form of a System.Security.SecureString
+	
     $Request = @{
     $Request = @{
       Method = "POST"
       Method = "POST"
       URI = "https://ntfy.example.com/mysecrets"
       URI = "https://ntfy.example.com/mysecrets"
-      Authorization = "Bearer"
-      Token = "tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2"
+      Authentication = "Bearer"
+      Token = ConvertTo-SecureString "tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2" -AsPlainText
       Body = "Look ma, with auth"
       Body = "Look ma, with auth"
     }
     }
     Invoke-RestMethod @Request
     Invoke-RestMethod @Request