API access while AD authentication is enabled

Hi Forum,

I have got a PHP application successfully talking to the Rancher API using an API key, however when enabling AD authentication the API access returns a 401 unathorized, if AD auth is disabled it starts working again?

FYI trying to hit the following endpoint: http://rancher.local.dev/v1/projects/1a5

We are only using one Rancher environment, ‘Default’ and currently on build v1.1.0-dev1.

Here’s the JSON response from the API with AD auth enabled:

{
“id”: “e58e3d24-2b4f-4e8a-ae25-318b019ffd98”,
“type”: “error”,
“links”: {},
“actions”: {},
“status”: 401,
“code”: “Unauthorized”,
“message”: “Unauthorized”,
“detail”: null
}

The keys you had are likely wrong, or for the wrong project, or not being sent at all… when access control is off there is no auth required so you can send anything and it will be “accepted” (because it’s just being ignored). Once it’s on the keys are required and checked.

Thanks Vincent, it’s working as expected now.