MG Software.
HomeAboutServicesPortfolioBlogCalculator
Contact Us
MG Software
MG Software
MG Software.

MG Software builds custom software, websites and AI solutions that help businesses grow.

© 2026 MG Software B.V. All rights reserved.

NavigationServicesPortfolioAbout UsContactBlogCalculator
ServicesCustom developmentSoftware integrationsSoftware redevelopmentApp developmentSEO & discoverability
Knowledge BaseKnowledge BaseComparisonsExamplesAlternativesTemplatesToolsSolutionsAPI integrations
LocationsHaarlemAmsterdamThe HagueEindhovenBredaAmersfoortAll locations
IndustriesLegalEnergyHealthcareE-commerceLogisticsAll industries
MG Software.
HomeAboutServicesPortfolioBlogCalculator
Contact Us
MG Software
MG Software
MG Software.

MG Software builds custom software, websites and AI solutions that help businesses grow.

© 2026 MG Software B.V. All rights reserved.

NavigationServicesPortfolioAbout UsContactBlogCalculator
ServicesCustom developmentSoftware integrationsSoftware redevelopmentApp developmentSEO & discoverability
Knowledge BaseKnowledge BaseComparisonsExamplesAlternativesTemplatesToolsSolutionsAPI integrations
LocationsHaarlemAmsterdamThe HagueEindhovenBredaAmersfoortAll locations
IndustriesLegalEnergyHealthcareE-commerceLogisticsAll industries
MG Software.
HomeAboutServicesPortfolioBlogCalculator
Contact Us
MG Software
MG Software
MG Software.

MG Software builds custom software, websites and AI solutions that help businesses grow.

© 2026 MG Software B.V. All rights reserved.

NavigationServicesPortfolioAbout UsContactBlogCalculator
ServicesCustom developmentSoftware integrationsSoftware redevelopmentApp developmentSEO & discoverability
Knowledge BaseKnowledge BaseComparisonsExamplesAlternativesTemplatesToolsSolutionsAPI integrations
LocationsHaarlemAmsterdamThe HagueEindhovenBredaAmersfoortAll locations
IndustriesLegalEnergyHealthcareE-commerceLogisticsAll industries
MG Software.
HomeAboutServicesPortfolioBlogCalculator
Contact Us
  1. Home
  2. /Knowledge Base
  3. /What is JWT? - Explanation & Meaning

What is JWT? - Explanation & Meaning

JWT securely packages user data into a signed token for stateless API authentication without server sessions, which suits microservice architectures well.

JWT (JSON Web Token) is an open standard (RFC 7519) for securely transmitting information between parties as a compact, URL-safe JSON object. JWTs are widely used for stateless authentication and authorization in modern web applications and APIs. The token itself contains all the claims needed to verify a request, eliminating the need for a central session store and simplifying horizontal scaling across services.

What is JWT? - Explanation & Meaning

What is JWT?

JWT (JSON Web Token) is an open standard (RFC 7519) for securely transmitting information between parties as a compact, URL-safe JSON object. JWTs are widely used for stateless authentication and authorization in modern web applications and APIs. The token itself contains all the claims needed to verify a request, eliminating the need for a central session store and simplifying horizontal scaling across services.

How does JWT work technically?

A JWT consists of three parts separated by dots: header, payload, and signature. The header contains the token type (typ: "JWT") and the signing algorithm used (such as HS256, RS256, or ES256). The payload contains claims: registered claims (iss for issuer, exp for expiration, sub for subject, aud for audience) and custom claims carrying information about the user, roles, and permissions. The signature is computed by combining the base64url-encoded header and payload with a secret (HMAC) or a private key (RSA/ECDSA). With stateless authentication, the server does not need to store session data: all required information is in the token itself and is verified on every request. Access tokens have a short lifespan (typically 5 to 15 minutes) while refresh tokens are longer-lived for obtaining new access tokens. Refresh token rotation ensures each refresh token can only be used once, enabling faster detection of stolen tokens. JWTs are ideal for microservice architectures because each service can independently validate the token using the authentication service's public key, without querying a shared database. JSON Web Key Sets (JWKS) publish public keys via a standard endpoint, so services automatically fetch the correct validation key and key rotation is handled transparently. Key security considerations include: always transmitting tokens over HTTPS, setting short expiration times, not including sensitive data in the payload (base64 is not encryption), storing tokens securely in httpOnly secure cookies instead of localStorage, validating audience and issuer claims, and preventing the "alg: none" vulnerability by enforcing the signing algorithm server-side. JWE (JSON Web Encryption) encrypts the entire token payload for use cases where the content must be confidential, unlike JWS (JSON Web Signature) which only guarantees integrity. Token binding ties a JWT to a specific TLS certificate of the client, making stolen tokens unusable on other devices. Proof of Possession (DPoP) is a newer RFC that provides a similar mechanism for public clients. When scaling microservice architectures, caching JWKS responses becomes essential to avoid overloading the authentication service, with a typical cache TTL of 5 to 60 minutes and a forced refresh on unknown key IDs. Token revocation remains a challenge with stateless tokens: common solutions include short expiration times, a token blacklist in Redis, or a combination with opaque reference tokens for scenarios requiring immediate revocation.

How does MG Software apply JWT in practice?

MG Software uses JWT as the standard authentication mechanism in our APIs and web applications. We implement an access/refresh token strategy with short-lived access tokens (10 minutes) and secure httpOnly cookies for refresh tokens with automatic rotation. In our Supabase integrations, we process JWTs for Row Level Security: the database reads claims directly from the token to enforce authorization at the row level without extra API calls. For microservice architectures, we use JWTs signed with RS256 or ES256 to authenticate requests between services without a shared session store. We publish public keys via a JWKS endpoint for automated key rotation. Custom claims are kept minimal to manage token size, and sensitive data is never placed in the payload. We implement token blacklisting via Redis for scenarios requiring immediate invalidation, such as password resets or account deactivation. Our JWT implementations include automated monitoring that alerts on unusual patterns such as spikes in expired tokens or tokens from unrecognized issuers.

Why does JWT matter?

JWTs enable scalable authentication across microservices and mobile clients without hitting a session store on every request. When the design is sound, services validate independently and you can enforce clear expiration, audience control, and key rotation for data access. For organizations offering multiple applications or APIs, JWT is the standard way to transport identity and permissions across service boundaries. The compact, URL-safe structure makes JWT suitable for HTTP headers, query parameters, and cross-domain communication. A well-designed JWT architecture reduces authentication latency because validation happens locally with cryptographic verification instead of a roundtrip to a session server. As API ecosystems grow more complex with external integrations and webhooks, JWT provides a standardized way to transfer trust across organizational boundaries.

Common mistakes with JWT

Long-lived access tokens stored in localStorage, where they are vulnerable to XSS attacks. Signing sensitive claims but not encrypting them while clients can simply read the base64-encoded payload. Weak HMAC secrets committed to source code and reusing the same secret across all environments. Failing to validate exp, aud, and iss claims, allowing expired or misdirected tokens to be accepted. Refresh tokens without rotation, so a stolen refresh token can fetch new access tokens indefinitely. Finally, accepting the "alg: none" header value, allowing attackers to submit unsigned tokens that a vulnerable library treats as valid.

What are some examples of JWT?

  • A web application that returns a JWT access token after login with a 10-minute validity period, after which a refresh token in an httpOnly cookie automatically requests a new access token without requiring the user to log in again.
  • A microservice architecture where each service validates incoming JWT tokens against the authentication service's public key via a JWKS endpoint, without querying a shared database and with automatic key rotation.
  • A mobile app that stores JWT tokens in the operating system's secure storage (iOS Keychain or Android Keystore) and sends them with every API request in the Authorization header with a Bearer prefix.
  • A Supabase-backed application where the JWT includes custom claims for user roles, so Row Level Security policies in PostgreSQL determine directly from the token which rows a user may read or modify.
  • A single sign-on environment where an identity provider issues JWT tokens accepted by multiple applications, with audience validation preventing a token for app A from being reused at app B.

Related terms

api securitytwo factor authenticationencryptionzero trustcybersecurity

Further reading

Knowledge BaseWhat is Two-Factor Authentication? - Explanation & MeaningOAuth 2.0 Explained: Authorization, Tokens, Scopes, and Secure Login Without PasswordsAuth0 vs Clerk: Enterprise Auth or Developer-First Identity?NextAuth vs Clerk: DIY Authentication or Drop-In Solution?

Related articles

OAuth 2.0 Explained: Authorization, Tokens, Scopes, and Secure Login Without Passwords

OAuth 2.0 enables secure access to third-party APIs and applications without sharing passwords. Discover how the authorization protocol behind every "Sign in with Google" flow works, which grant types exist, and how to implement it securely.

What is an API Gateway? - Definition & Meaning

An API Gateway serves as the front door to your microservices: routing, rate limiting, authentication, and monitoring from a single entry point.

What is Two-Factor Authentication? - Explanation & Meaning

Two-factor authentication adds an extra security layer beyond passwords, for example via authenticator apps, SMS codes, or passkeys for account protection.

Auth0 vs Clerk: Enterprise Auth or Developer-First Identity?

Okta-backed RBAC with 7,000+ integrations or beautiful pre-built React auth components? Auth0 and Clerk target fundamentally different auth needs.

Frequently asked questions

JWT is secure when implemented correctly. Always use strong signing algorithms (RS256 or ES256 over HS256 for public APIs), set short expiration times, transmit tokens exclusively over HTTPS, and store them in httpOnly secure cookies. Avoid including sensitive data in the payload, as it is base64-encoded but not encrypted. Always validate audience, issuer, and expiration claims server-side.
With session cookies, the server stores session data and only sends a session ID to the client. With JWT, the token itself contains all required information (stateless). JWT is better suited for distributed systems, APIs, and microservices, while session cookies are simpler for traditional web applications with a single server. The downside of session cookies is that they require a shared session store when scaling horizontally.
JWTs are inherently not revocable because they are stateless and the server does not maintain a list of valid tokens. Solutions include: using short expiration times so tokens expire quickly, maintaining a token blacklist in Redis or a fast database (which partially reduces the stateless advantage), or token versioning via a claim that is updated on logout. Refresh token rotation provides a good balance between security and performance.
A JWKS (JSON Web Key Set) endpoint is a publicly accessible URL that exposes the authentication service's public keys in a standardized JSON format. Services that need to validate JWT tokens retrieve the correct key via this endpoint, identified by the kid (key ID) field in the token header. This enables automated key rotation without requiring all consuming services to be updated manually.
HS256 is a symmetric algorithm that uses the same secret for both signing and verification. This is simple but requires every service that validates tokens to know the secret, which is a security risk. RS256 is asymmetric: the issuer signs with a private key and every consumer verifies with the public key. RS256 is more secure for public APIs and microservice architectures because the private key only needs to reside with the issuer.
Store access tokens in httpOnly secure cookies with SameSite attributes to mitigate XSS and CSRF. Never use localStorage for tokens that grant access to sensitive data. Set short expiration times so stolen tokens expire quickly. Implement refresh token rotation so each refresh token is only usable once. Monitor for anomalous token patterns such as tokens being used from multiple IP addresses simultaneously.
Use JWT when services need to validate tokens locally without a roundtrip to the authentication server, such as in microservice architectures and mobile apps. Use opaque tokens when you want full control over token revocation and the authentication server can be consulted on every request. Opaque tokens are simpler to revoke but scale less well. Many systems combine both: JWT for service-to-service communication and opaque refresh tokens for session management.

We work with this daily

The same expertise you're reading about, we put to work for clients.

Discover what we can do

Related articles

OAuth 2.0 Explained: Authorization, Tokens, Scopes, and Secure Login Without Passwords

OAuth 2.0 enables secure access to third-party APIs and applications without sharing passwords. Discover how the authorization protocol behind every "Sign in with Google" flow works, which grant types exist, and how to implement it securely.

What is an API Gateway? - Definition & Meaning

An API Gateway serves as the front door to your microservices: routing, rate limiting, authentication, and monitoring from a single entry point.

What is Two-Factor Authentication? - Explanation & Meaning

Two-factor authentication adds an extra security layer beyond passwords, for example via authenticator apps, SMS codes, or passkeys for account protection.

Auth0 vs Clerk: Enterprise Auth or Developer-First Identity?

Okta-backed RBAC with 7,000+ integrations or beautiful pre-built React auth components? Auth0 and Clerk target fundamentally different auth needs.

MG Software
MG Software
MG Software.

MG Software builds custom software, websites and AI solutions that help businesses grow.

© 2026 MG Software B.V. All rights reserved.

NavigationServicesPortfolioAbout UsContactBlogCalculator
ServicesCustom developmentSoftware integrationsSoftware redevelopmentApp developmentSEO & discoverability
Knowledge BaseKnowledge BaseComparisonsExamplesAlternativesTemplatesToolsSolutionsAPI integrations
LocationsHaarlemAmsterdamThe HagueEindhovenBredaAmersfoortAll locations
IndustriesLegalEnergyHealthcareE-commerceLogisticsAll industries