Ma page Github
Send HTTP Rest API request using Windows Powershell Version 7 with Bearer/Token Authentication
<# The **Invoke-RestMethod** requires an instance of
.NET SecureString in which the Bearer Token is to be stored: #>
$sString = [SecureString]::new()
<# Populate the SecureString with our Token string #>
"MyTokEnStrinGHexHhHhhHhHh".ToCharArray() | %{ $sString.AppendChar($_) }
<# Invoke the API call using HTTP
('irm' is the abbreviation for **Invoke-RestMethod** in Powershell #>
$response = irm "https://api.host.com/client/v4/user/tokens/verify" `
-Authentication Bearer -Token $sString