> For the complete documentation index, see [llms.txt](https://docs.one-cp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.one-cp.com/integration-and-development/1-cp-corporate-checkout-api/authentication.md).

# 🔐 Authentication

All API endpoints require **HTTP Basic Authentication** using your 1-CP credentials.

#### Authentication Process

1. **Combine Credentials**: Format as `widget_id:backend_secret`
2. **Encode**: Convert to base64: `base64(widget_id:backend_secret)`
3. **Set Header**: `Authorization: Basic <base64_string>`

{% hint style="warning" %}
**Security Note**: Always use HTTPS in production and never expose your backend secret in client-side code.
{% endhint %}

#### Example Authentication

```javascript
// JavaScript example
const credentials = btoa('your_widget_id:your_backend_secret')
const headers = {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
}
```

```python
# Python example
import base64
import requests

credentials = base64.b64encode('widget_id:backend_secret'.encode()).decode()
headers = {
    'Authorization': f'Basic {credentials}',
    'Content-Type': 'application/json'
}
```
