Authentication
š Authentication
Ditto IDVerify APIs require valid authentication to access any endpoint. The authentication is provided via the Authorization header in each API request. Ditto IDVerify supports two types of authentication schemes:
1. š§¾ Basic Authentication
Basic authentication involves encoding a username and password into a base64 string.
š How to Use
- Format your credentials as
username:password - Base64 encode the string. For example:
reliduser:password123becomescmVsaWR1c2VyOnBhc3N3b3JkMTIz
- Add to the Authorization header:
Authorization: Basic cmVsaWR1c2VyOnBhc3N3b3JkMTIz
ā Failure Response
{
"response_code": 1,
"error_code": 2604,
"error_message": "Authorization failed"
}2. š” OAuth2 Authentication
OAuth2 Bearer Tokens provide more secure and scalable authentication for production use.
š How to Use
- Obtain the token by authenticating via the Ditto ID Auth Server (see
/oauth/token) - Add it to the request header:
Authorization: Bearer <your-access-token>
ā Failure Response
{
"response_code": 1,
"error_code": 2604,
"error_message": "Authorization failed",
"error": "invalid_token",
"error_description": "Access token expired"
}ā Response Headers (OAuth2 failure)
WWW-Authenticate: Contains the reason for failure, such as:WWW-Authenticate: Bearer error="invalid_token", error_description="Access token expired"
šØ Error Codes Reference
| Error Code | Error Message | Scenario |
|---|---|---|
| 2601 | Authorization header not found | Empty/missing Authorization header |
| 2604 | Authorization failed | Invalid or expired credentials/token |
| 2605 | Authorization failed | Internal error during authentication |
| 2606 | Authorization failed | Invalid value in authorization header |
ā
Recommended Approach
- Use OAuth2 for production deployments
- Use Basic Auth for initial development/testing
- Always keep client credentials secure and rotate tokens regularly
š Getting Credentials
- Client credentials (Client ID and Secret) are issued by the Ditto ID Admin using the Gateway Manager Console
- Enterprises may use multiple credentials (Enterprise IDs) to isolate app flows by department or product
Updated 4 months ago
