# API access while AD authentication is enabled

**URL:** <https://forums.suse.com/t/api-access-while-ad-authentication-is-enabled/2846>\
**Category:** General\
**Created:** [May 19, 2016, 12:03pm UTC](https://forums.suse.com/t/api-access-while-ad-authentication-is-enabled/2846 "2016-05-19T12:03:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jon\_Brookes](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@Jon\_Brookes](https://forums.suse.com/u/Jon_Brookes)\
**Post date:** [May 19, 2016, 12:03pm UTC](https://forums.suse.com/t/api-access-while-ad-authentication-is-enabled/2846/1 "2016-05-19T12:03:14Z")

</div>

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](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  
}

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [May 20, 2016, 5:26am UTC](https://forums.suse.com/t/api-access-while-ad-authentication-is-enabled/2846/2 "2016-05-20T05:26:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jon\_Brookes](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@Jon\_Brookes](https://forums.suse.com/u/Jon_Brookes)\
**Post date:** [May 20, 2016, 10:47am UTC](https://forums.suse.com/t/api-access-while-ad-authentication-is-enabled/2846/3 "2016-05-20T10:47:33Z")

</div>

Thanks Vincent, it’s working as expected now.
