# starlette.exceptions.HTTPException: 401: Unauthorized

- **ID:** `python/starlette-httpexception-401`
- **Domain:** python
- **Category:** auth_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Authentication credentials are missing or invalid.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 0.30.x | active | — | — |
| 0.40.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   headers = {'Authorization': f'Bearer {token}'}
   ```
2. **** (90% success)
   ```
   If 401, use refresh token to get a new access token.
   ```

## Dead Ends

- **** — Exposes protected endpoints. (90% fail)
- **** — Security risk. (95% fail)
