๐ Django Trusted Devices¶
Welcome to the official documentation for the Django Trusted Devices library.
This package provides JWT-based trusted device tracking with per-device session control and security.
๐ Features¶
- ๐ JWT tokens include a unique
device_uid - ๐ Auto-detect IP, region, and city via configurable geolocation backend
- ๐ก๏ธ Per-device session tracking with update/delete restrictions
- ๐ Custom
TokenObtainPair,TokenRefresh, andTokenVerifyviews - ๐ช Logout & revoke โ logout current session or revoke all other devices
- ๐งผ Automatic cleanup of stale devices on login + management command
- ๐ท๏ธ Device naming โ let users label their devices
- ๐
is_currentflag โ identify which device is making the request - ๐จ Suspicious login detection โ signals when a login comes from a new country
- ๐ Rate limiting on login to prevent brute-force attacks
- ๐ Max device limit โ configurable cap with oldest-device eviction
- โ ๏ธ Custom exception classes โ catchable, typed errors with stable codes
- ๐ Full OpenAPI/Swagger schema via drf-spectacular
- ๐งฉ API-ready โ supports DRF out of the box
- โ๏ธ Fully customizable via
TRUSTED_DEVICEDjango settings
๐ Documentation¶
- Usage Guide โ installation, configuration, and integration
- API Reference โ endpoints, fields, and response schemas
- Signals โ device lifecycle events and suspicious login detection
- Exceptions โ custom error classes and error codes
- Geolocation โ custom geolocation backends
- Contributing โ how to contribute