π Authentication
All API endpoints require HTTP Basic Authentication using your One-CP credentials.
Authentication Process
Combine Credentials: Format as
widget_id:backend_secret
Encode: Convert to base64:
base64(widget_id:backend_secret)
Set Header:
Authorization: Basic <base64_string>
Security Note: Always use HTTPS in production and never expose your backend secret in client-side code.
Example Authentication
// JavaScript example
const credentials = btoa('your_widget_id:your_backend_secret')
const headers = {
Authorization: `Basic ${credentials}`,
'Content-Type': 'application/json'
}
# Python example
import base64
import requests
credentials = base64.b64encode('widget_id:backend_secret'.encode()).decode()
headers = {
'Authorization': f'Basic {credentials}',
'Content-Type': 'application/json'
}