# fastapi.exceptions.HTTPException: 401 Unauthorized: {"detail":"Not authenticated"}

- **ID:** `python/fastapi-oauth2-token-missing`
- **Domain:** python
- **Category:** auth_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The Authorization header was missing or malformed, so the OAuth2PasswordBearer dependency rejected the request before reaching the route.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 0.100+ | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   fetch('/me', {headers: {'Authorization': `Bearer ${token}`}})
   ```
2. **** (85% success)
   ```
   def get_token(request: Request):
    return request.cookies.get('access_token')
   ```

## Dead Ends

- **** — Route then receives None token and crashes on decode. (80% fail)
- **** — Auth bypass ships to production; security hole. (90% fail)
