Skip to content

๐Ÿ” 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, and TokenVerify views
  • ๐Ÿšช 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_current flag โ€” 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_DEVICE Django 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