I’m trying to interact with my Ansible Automation Platform (AAP) instance via REST API. We use SSO, so based on this answer I logged in as the user via the web GUI and created a personal token. I’m now trying to call REST requests against it and receive the same error as when I was using username/password:
Invoke-RestMethod -Headers @{ Authorization = "Bearer $token" } -Method Get -Uri https://<ansible>/rest/v2/job_templates
{
"detail": "Authentication credentials were not provided. To establish a login session, visit /api/login/."
}
I’ve also tried the refresh token, a base64-encoded token, as well as base64-encoded username:password and all throw the same error:
@{ Authorization = "Bearer $refresh_token" }
@{ Authorization = "Basic $base64_token" }
@{ Authorization = "Basic $base64_username_password" }