UUID Use Case
UUID Refresh Token
A refresh token outlives access tokens so users stay logged in. Because it is powerful, it should be a random UUID, stored hashed, and rotated on use.
Long-livedRotate on useStore hashed
Generated locally with the Web Crypto API — nothing leaves your browser.
What Is UUID Refresh Token?
- The refresh token is the crown jewel: with it an attacker can mint access tokens indefinitely, so it must be unguessable (v4) and stored only as a hash.
- Rotate it on every use — issue a new UUID and invalidate the old one — so a stolen token stops working after one reuse.
How to generate
- Generate a v4 UUID refresh token at login.
- Store a hash; return the raw value to the client.
- On refresh, verify the hash, then rotate to a new UUID.
Use Cases
- Mobile persistent sessions.
- SPA silent re-authentication.
- Desktop app background auth.
Code Examples
JavaScript
const id = crypto.randomUUID();Python
import uuid
id = uuid.uuid4()Frequently Asked Questions
Why rotate refresh tokens?
Rotation means a leaked token is useless after the next legitimate refresh, limiting the window of abuse.
Where to store it client-side?
HttpOnly cookie for web; secure device storage for mobile. Never local-storage it in a browser.
Related tools
UUID v1 GeneratorUUID v3 GeneratorUUID v4 GeneratorUUID v5 GeneratorUUID v6 GeneratorUUID v7 GeneratorUUID v8 GeneratorBulk UUID GeneratorShort UUID GeneratorUUID ValidatorUUID FormatterUUID as a Primary KeyUUID Database IDUUID Foreign KeyUUID Shard KeyUUID Partition KeyUUID in a Composite KeyUUID Surrogate KeyUUID API KeyUUID Session TokenUUID Access TokenUUID Refresh TokenUUID Idempotency KeyUUID Request IDUUID Correlation IDUUID Trace IDUUID CSRF TokenUUID NonceUUID FilenameUUID Object KeyUUID S3 KeyUUID Upload IDUUID Cache KeyUUID Blob NameUUID Temp FileUUID User IDUUID Account IDUUID Customer IDUUID Device IDUUID Tenant IDUUID Client IDUUID Anonymous IDUUID Member IDUUID Message IDUUID Event IDUUID Job IDUUID Task IDUUID Queue Message IDUUID Transaction IDUUID Order IDUUID Invoice IDUUID Payment IDUUID Reset TokenUUID Verification TokenUUID Invite CodeUUID API SecretUUID Share LinkUUID Magic LinkUUID Node IDUUID Worker IDUUID Lock IDUUID Cluster IDUUID Test DataUUID Seed DataUUID FixtureUUID Mock IDUUID Placeholder IDUUID Sample ID