# AttributeError: 'NoneType' object has no attribute 'is_authenticated'

- **ID:** `python/flask-login-user-loader-none`
- **Domain:** python
- **Category:** auth_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Flask-Login user_loader returned None for the session's user ID, often after the user was deleted.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 0.6.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   @login_manager.user_loader\ndef load(uid):\n    return db.session.get(User, int(uid))\n# template: {% if current_user.is_authenticated %}
   ```
2. **** (90% success)
   ```
   if not current_user.is_authenticated:\n    logout_user()
   ```

## Dead Ends

- **** — Disables protection but current_user remains None. (80% fail)
- **** — Bypasses auth checks and creates security holes. (90% fail)
