I'm using PowerShell's Invoke-RestMethod applet to make a basic authenticated connection to the Jira Cloud REST API.
When I form the header using a Basic username:plaintextpassword pair that is then Base64 encoded before submission, everything works just fine. When I substitute my token for the password then Base64 encode the pair, as described in the REST API documentation, the authentication fails.
Here is my PowerShell sample:
$pair = "name@company.com:Kt5p2nfqTsqnvljKXpB6FCG3"
$bytes = [System.Text.Encoding]::ASCII.GetBytes($pair)
$base64 = [System.Convert]::ToBase64String($bytes)
$basicAuthValue = "Basic $base64"
$headers = @{ Authorization = $basicAuthValue }
Invoke-RestMethod -Uri https://jira.mycompany.com/rest/api/2/project -Method Get -Headers $headers