Start here. This is the direct spoken answer to practice first.
Overview
Uses cryptographically secure token generation and timing-resistant comparison at credential boundaries.
Python's secrets module is for security-sensitive values such as reset tokens, API keys, and nonces. The random module is designed for simulation and reproducible sampling, not adversarial guessing. I generate enough entropy with token_bytes, token_hex, or token_urlsafe, store only a hash when the raw token need not be recovered, and give the token an expiry and one-time-use rule.