Authentication at the edgewith Clerk and Next.js

Two strategies

Clerk supports both stateless and stateful authentication at the edge

Stateless

Recommended

Before a request, Clerk generates a short-lived JWT (JSON Web Token) for authentication. Verifying the JWT takes less than 1 ms!

Stateless demo

Response time
-- ms
Authentication speed
-- ms
Response region
--
User ID
--

Stateless done right

Short-lived, automatically-refreshing JWTs provide simple, robust security

Short-lived

Each JWT only lasts 60 seconds. If a session needs to be revoked, this short lifetime ensures attackers will be stopped within 60 seconds.

Automatically-refreshing

Clerk's Next.js SDK automatically refreshes tokens before they expire, so there's no extra work for developers. Watch it in real - time below.

Try revocation

Sign in on two devices to test revocation

Ready for authentication at the edge?

Stateless, revocable authentication is included in every Clerk plan.