| title | Moorcheh API Auth Header Bug |
|---|---|
| domain | api |
| evidence_level | E1 |
The Moorcheh API was not accepting authentication headers correctly, causing 401 Unauthorized errors.
The API expected the auth token in the format Bearer {token}, but the client was sending it as {token} only.
Added proper Bearer prefix to the auth header before sending requests.
- Added
Bearerprefix to the token - Added validation to ensure token exists before sending
- Added error handling for missing tokens
- Always check API documentation for expected header formats
- Add logging for auth failures
- Test auth flow with different scenarios
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}