# POST /admin/oauth

> Enable or disable OAuth on DS Server with a JSON object whose active field is true or false; the running server applies the new setting only after a restart.

- **Product:** DS Server
- **Section:** Documentation
- **Kind:** Endpoint
- **Path:** DS Server > API Reference > Web API > Administration > /oauth > POST /admin/oauth
- **587 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/web-api/administration/oauth/post/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/web-api/administration/oauth/post/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/web-api/administration/oauth/post/llms-full.txt

---

`POST` `https://example.com/admin/oauth`

### Description

Enables or disables OAuth, the setting of the **OAuth enabled** / **OAuth disabled** switch on the **Security Profiles** page of the admin portal. See [Enable OAuth](https://docs.textcontrol.com/ds-server/administration/oauth/llms-full.txt).

DS Server stores the new setting at once, and [GET /admin/oauth](https://docs.textcontrol.com/ds-server/reference/web-api/administration/oauth/get/llms-full.txt) and the admin portal show it, but the running server keeps checking access tokens as before until it is restarted. The switch in the admin portal takes effect at once.

### Examples

The following sample enables OAuth.

```bash
# Request:
curl --request POST 'https://trial.dsserver.io/admin/oauth' \
    --header 'Authorization: Basic YWRtaW46YWRtaW5hZG1pbg==' \
    --header 'Content-Type: application/json' \
    --data-raw '{ "active": true }'

# Result:
true
```

### Authorization

This endpoint supports the Basic authorization method:

#### Basic

| Header field | Description |
|---|---|
| Authorization | The username "admin" and your admin password are combined into a string separated by a colon, e.g.: admin:password. The resulting string is encoded using the RFC2045-MIME variant of Base64, except not limited to 76 char/line. The authorization method and a space i.e. "Basic " is then put before the encoded string. For example: `Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l` |

### Request Payload

| Type | Value |
|---|---|
| Object | A JSON object (`application/json`) with the Boolean field `active`: `true` enables OAuth, `false` disables it. An empty object `{}` disables OAuth. |

### Success Response

| Status | Description |
|---|---|
| 200 | On success, the HTTP status code in the response header is 200 (OK). The return value is the new setting, `true` or `false`. |

### Error Response

| Status | Description |
|---|---|
| 401 | A 401 (Unauthorized) is returned, if the user is not authorized. |
| 500 | A 500 (Internal Server Error) is returned, if the body is missing or is not a JSON object, for example the bare value `false`. |

---

## Nearby

- **Previous:** [GET /admin/oauth](https://docs.textcontrol.com/ds-server/reference/web-api/administration/oauth/get/llms-full.txt)
- **Next:** [/admin/authenticationservers](https://docs.textcontrol.com/ds-server/reference/web-api/administration/authenticationservers/llms-full.txt)
