Course contentsShow
← Web Development
Lesson 1581 of 2,98229. Web Authentication PatternsFree lesson

Standard JWT Claims

Learning common registered claims like iss, sub, exp, iat, and when to use them.

Standard JWT Claims

You'll learn the most common registered JWT claims and when to use each one in real authentication flows.

What Are Registered Claims?

JWT defines a set of registered claims—standardized fields that convey metadata about the token itself. Think of them as the "postal service" fields on an envelope: the sender, recipient, expiration date, and tracking number. While optional, using these claims helps different systems understand your tokens consistently.

The Core Registered Claims

iss (Issuer)

Identifies who created and signed the token. Usually your authentication server's URL.

"iss": "https://auth.yourapp.com"

sub (Subject)

Identifies the user or entity the token represents—typically a user ID.

"sub": "user_12345"

exp (Expiration Time)

Unix timestamp when the token expires. Critical for security—always set this.

"exp": 1735689600

iat (Issued At)

Unix timestamp when the token was created. Useful for age tracking.

"iat": 1735603200

aud (Audience)

Intended recipient of the token—which service should accept it.

"aud": "api.yourapp.com"

When to Use Each

  • iss: Multi-service architectures where tokens might come from different auth servers
  • sub: Always—you need to know who this token represents
  • exp: Always—never create tokens without expiration
  • iat: When you need to calculate token age or enforce "issued after" policies
  • aud: When multiple APIs exist and tokens shouldn't work everywhere

Key Takeaway: Use sub and exp in every JWT; add iss, iat, and aud when your architecture needs to distinguish token sources, track token age, or limit where tokens are accepted.