Sigma announces $100M in ARR
A yellow arrow pointing to the right.
A yellow arrow pointing to the right.
No items found.
April 17, 2025

What’s Securing Your Data Behind The Scenes? A Look At JSON Web Tokens

April 17, 2025
What’s Securing Your Data Behind The Scenes? A Look At JSON Web Tokens

Every time you log into an analytics dashboard, call an API, or explore rows in a shared workbook, a small but important question is being asked: Who are you, and what are you allowed to see? For most data folks, that question is answered invisibly in milliseconds through a JSON Web Token (JWT). It’s a compact, digitally signed package containing sufficient information to verify your identity and permissions. There’s no session state stored on a server or clunky database lookups. Just a smart, lightweight way to pass identity between systems in motion.

JWTs have become a quiet staple in the architecture of modern data platforms. They’re part of what makes things like embedded dashboards, secure APIs, and multi-tool workflows possible, scalable, and responsive. And when implemented well, they can achieve this without compromising security or impacting performance.

In this blog post, we’ll break down what JWTs are, how they keep your analytics systems secure, and where they show up in your daily tools, even if you’ve never seen one in action. Along the way, we’ll highlight the benefits, trade-offs, and real risks to be aware of. You’ll leave with a clearer understanding of how authentication works in distributed data systems and what makes JWTs a go-to solution for teams working at scale.

What are JSON Web Tokens?

A JSON Web Token, or JWT (pronounced “jot”), is a small string of text that carries a few important facts about who you are and what you’re allowed to do. At its core, it’s just a compact way to prove identity and permissions without asking a server to remember you. A JWT is made up of three parts, separated by dots: the header, the payload, and the signature.

The header typically specifies the algorithm used to sign the token, such as HS256 or RS256. The payload contains the transmitted data, often including user ID, role, and expiration time. The signature is a hashed combination of the header and payload, created using a secret or private key, allowing systems to verify that the token hasn’t been altered. 

Here’s what a JWT might look like when used to access an embedded dashboard in a BI platform:

Header (first part):

{
  "alg": "RS256",
  "typ": "JWT"
}

This token uses RS256, meaning it was signed with a private key, and can be verified with a public key, which is a good choice for cloud-based or embedded dashboards where services verifying the token don’t control the signer.

Payload (second part):

{
  "user_id": "data_user_123",
  "role": "report_viewer",
  "db_id": "sales_dataset",
  "exp": 1715223200
}

"user_id" identifies the user requesting access.

"role" describes what they’re allowed to do (in this case, view dashboards).

"db_id" could be used to scope access to a particular dataset.

"exp" sets the expiration time as a Unix timestamp.

Signature (third part): A cryptographic hash that ensures the token hasn’t been altered. It's created by signing the header and payload using the issuer’s private key.

When combined, the JWT becomes a single string that can be passed in an HTTP header or embedded in a request:

eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.
eyJ1c2VyX2lkIjoiZGF0YV91c2VyXzEyMyIsInJvbGUiOiJyZXBvcnRfdmlld2VyIiwiZGJfaWQiOiJzYWxlc19kYXRhc2V0IiwiZXhwIjoxNzE1MjIzMjAwfQ.
U1l4Q0lsdmhxeVFTcE5HUGdDSnJwUnVDdmFrcERhRjFQTWZsM0NvN1kxN2ZKVXNyRzMwNDNn

Even though it may appear to be gibberish, that string is actually a URL-safe method for carrying useful data between systems. It’s easy to pass in an HTTP header or embed in a link, making JWTs a natural fit for distributed systems where requests move quickly and frequently. 

Because the signature is tied to a known secret or public key, any system that receives the token can double-check that it hasn’t been tampered with. That means you can trust the information it carries as long as the token was issued and signed correctly in the first place.

How JWTs securely transmit user data

Once a JWT has been issued, its job is to carry trusted information like a user’s role or dataset access between systems that don’t share state. The trust comes from how the token is signed and how that signature is verified. When a service receives a JWT, it doesn’t ask a database, session store, or identity provider whether the token is valid. 

Depending on how the token was signed, the signature is verified locally, using either a shared secret key or a public key. JWTs are so effective in distributed data systems because services can operate independently while still agreeing on a user’s identity and permissions.

There are two common ways to sign a JWT:

  1. Symmetric algorithms like HS256: One secret key is used to sign and verify. This is often used in simpler or tightly controlled environments where all services share the same key like internal reporting APIs.
  2. Asymmetric algorithms like RS256: A private key signs the token, and a public key verifies it. This model works well when different services, such as embedded dashboards, external clients, or cloud API,s need to validate the token without sharing secrets.

JWTs can also be encrypted, but that’s far less common in analytics systems. The payload typically includes information such as user IDs, roles, or project scopes; nothing particularly sensitive. Signing alone is enough to ensure the data hasn’t been altered. That said, how the token is transported matters. JWTs should always be sent over HTTPS to protect them from being intercepted. Even a well-signed token becomes a liability if it’s exposed in plain text or stored where it can be scraped, like localStorage or front-end code.

In practice, JWTs are used to pass small claims between systems: “This user is a report_viewer,” “This token expires in 15 minutes,” “This request is for the sales_dataset.” These claims allow each service to quickly decide access without extra database queries or external validation steps. The result is a system that can move faster, scale cleaner, and keep identity and permissions in check.

Enabling stateless authentication with JWTs

Traditionally, when a user logs in, the server creates a session and stores it, often in memory or a database. Each time the user makes a request, the server looks up the session to determine who they are. That’s called stateful authentication, and it works well when everything runs on a single server. But once you start building distributed systems with APIs, microservices, or analytics tools that span across clouds and regions, the setup gets clunky fast. Sessions need to be shared or replicated, and every service has to stay in sync.

JWTs offer a different model called stateless authentication. Instead of storing session data, the system gives the user a signed JWT after login. That token contains everything needed to identify the user and check permissions. It’s self-contained and portable, meaning it can be passed between services without extra coordination. Each service that receives the token can verify the signature and extract the payload. There are no lookups, no shared memory, and no waiting.

This stateless design brings several advantages. It reduces server load since there’s no need to maintain or retrieve session data for each request. It also makes scaling easier, allowing services to run independently while maintaining user context awareness. Because the token is portable, a single JWT can be reused across APIs, embedded dashboards, and third-party tools without requiring additional coordination. 

Imagine logging into a data platform and getting a JWT. You can use that same token to access reports, run queries, or view dashboards across multiple tools as long as each one knows how to verify the token. Stateless authentication also pairs well with modern deployment models, like serverless functions and containerized services, where persistence is limited and everything needs to move quickly.

Simplifying API access and integration

When analytics tools connect to data to pull a dashboard, call a service, or run a query, they often do it through APIs. These requests need to be authenticated and authorized quickly. JWTs make that process more direct. Instead of managing sessions or running permission checks at every step, a system can attach a JWT to each request, usually in the Authorization header. The receiving API reads the token, verifies its signature, and checks the embedded claims like user ID, role, or expiration time. It all happens in a single step without returning to a database or session store.

This design plays well with role-based access control (RBAC). When a JWT includes a user’s role or group memberships, each service along the path can decide what actions are allowed, such as querying a dataset, exporting a report, or viewing a page in a dashboard. Standards such as OAuth 2.0 and OpenID Connect utilize JWTs to securely pass these claims. That’s why JWTs appear frequently in platforms that enable third-party logins, API access, or embedded analytics; they simplify the authentication flow without compromising control. From a developer’s perspective, JWTs reduce the need for custom authentication code or external session dependencies. As long as the token is signed and the claims are trusted, it can be used across multiple services in a way that stays clean, portable, and consistent.

This matters for analytics work because data often moves across systems: from ingestion to transformation to visualization. JWTs give those systems a shared language for user identity and permissions, without adding extra steps or delays.

How JWTs work in modern analytics workflows

JWTs often operate behind the curtain, but their presence can shape how smoothly an analytics workflow runs from secure access to automated orchestration. Take embedded dashboards. When a company wants to give a client access to a dashboard inside a portal, it doesn’t want to maintain a separate login system. Instead, it can generate a short-lived JWT containing the client’s identity and permissions. That token gets passed to the dashboard, which reads the claims and renders only the allowed data. Or consider users switching between tools, perhaps running a query in one system and reviewing the output in another. If both tools can read and verify the same type of JWT, the user only needs to authenticate once. 

The token carries their role and access rights between tools, keeping everything in sync without extra steps.JWTs also appear in background services, such as data pipelines, machine learning models, or reporting jobs, which transfer data from one location to another. Each service can authenticate itself using a JWT, passing along context and authorization with every step. That helps enforce access rules consistently even in automated, low-visibility systems.

For teams building on zero-trust principles, where every request must be verified regardless of source, JWTs offer a way to carry identity between loosely connected services without assuming anything is safe by default. Each component checks the token on its own, which fits the needs of decentralized systems. In short, JWTs make it possible to secure and scale analytics workflows without constantly asking, “Who is this, and what are they allowed to do?” That context travels with the token.

Limitations and potential risks of JWTs

JWTs offer a clean way to pass identity between systems, but not without trade-offs. Used carelessly, they can introduce new and unexpected problems.

One of the most common challenges is token expiration. Because JWTs are stateless and self-contained, there's no easy way to revoke them once issued. If a token is valid for too long and falls into the wrong hands, that access sticks around until the token naturally expires. To reduce that risk, tokens should be short-lived, think minutes, not hours. 

However, short lifespans mean you need a way to get new tokens without constantly forcing users to log in. That’s where refresh tokens come in. A short-term JWT grants access, while a longer-lived refresh token stays behind the scenes and quietly asks for a new JWT when needed. Refresh tokens must be stored securely; otherwise, they will become another point of vulnerability.

Another issue: JWTs don’t come with built-in revocation. Unlike session IDs, which can be deleted server-side, JWTs can’t easily be invalidated after they’ve been handed out. That means if a user’s permissions change or if a token needs to be cut off for any reason, you can’t just “turn it off” unless you've set a very short expiration window. 

There’s also the risk of token theft or replay attacks. If a JWT is stored in localStorage or exposed over an insecure connection, someone could capture it and reuse it elsewhere. This is why JWTs should always travel over HTTPS and should never be stored in places that scripts can easily access.

One more subtle problem: Packing too much into the payload is tempting. Since the token travels with every request, adding a lot of sensitive or bulky data can slow things down and expose information that doesn’t need to be shared. 

JWTs work best when the payload is minimal and just enough to communicate identity and permissions. Security in JWT-based systems isn’t automatic. It takes thoughtful design with short token lifespans, secure storage, encrypted channels, and regular key rotation so that tokens signed with old keys can’t be reused. JWTs can be a wise choice, but only when implemented carefully.

Best practices for using JWTs in analytics environments

JWTs can make authentication simpler and more flexible, but they must be implemented with care. Especially in analytics systems where data access and permissions are critical, following best practices can help you avoid common security gaps. Here’s what teams should keep in mind:

Always use HTTPS

Even though a JWT’s signature helps detect tampering, the contents can still be intercepted if sent over an unsecured connection. Every token should be passed over HTTPS to prevent exposure.

Keep the payload minimal

Only include the claims that are necessary for authorization. Avoid putting in sensitive information like passwords, email addresses, or anything that doesn’t need to be shared with every service. The token travels with each request, so a lean payload keeps things fast and safe.

Set short expiration times

Tokens should be short-lived to reduce the window of risk if they’re ever compromised. A 15-minute expiration is standard for active sessions. Pair this with refresh tokens for smoother user experiences without sacrificing security. Short lifespans also encourage more frequent validation, which can help surface suspicious activity faster.

Use refresh tokens carefully

Store refresh tokens in secure, HTTP-only storage and never expose them to scripts. This allows users to stay logged in without constantly re-authenticating while keeping short-term JWTs on a tight leash.

Rotate signing keys regularly

Changing your keys on a schedule helps limit the damage if a private key is exposed. When you rotate keys, make sure old tokens signed with previous keys can be validated until they expire then phase them out. Regular rotation also reinforces healthy key management practices across the team.

Rely on well-supported libraries

Don’t write your own JWT implementation unless absolutely necessary. Use libraries that are actively maintained, well-documented, and have built-in validation logic. This reduces the chance of missing subtle but important details in the verification process. Trusted libraries also make it easier to keep up with security updates and evolving best practices. Many libraries also include safeguards for common pitfalls, like rejecting expired tokens or checking for required claims by default.

These practices are for security but also improve performance, system maintainability, and user trust. In analytics environments, where data exposure and access control are constant concerns, getting JWTs right can prevent major issues before they surface.

How does JWT compare to other authentication methods

JWTs aren’t the only way to manage authentication. Depending on the system, you might see session cookies, API keys, or OAuth tokens in use. So, where does JWT fit and how does it stack up?

JWTs vs. session cookies

Session cookies work by storing a session ID on the server. When a user logs in, the server keeps track of their session, and a cookie gets stored in the browser to reference it. This works well in monolithic apps but doesn’t scale easily. With JWTs, there’s no session to manage. The user’s identity and permissions travel with them in the token, allowing services to verify requests without relying on shared server state.

JWTs vs. API keys

API keys are simple and widely used, but they don’t carry any context about the user. If you pass an API key, the system knows you’re allowed in, but not necessarily who you are or your role. JWTs, on the other hand, can carry claims like user ID, role, or team, which enables finer-grained access control. This is especially helpful in analytics tools where permission boundaries matter.

JWTs and OAuth tokens

OAuth 2.0 is a protocol for authorization, not a token format, but many OAuth systems issue JWTs as access tokens. These tokens can be passed between services, allowing apps to authenticate users and grant access to resources on their behalf. JWTs fit well into this pattern, especially when combined with OpenID Connect for identity data.

JWTs in modern analytics stacks

JWTs are often the better fit in distributed, cloud-based analytics platforms. They travel easily between services, reduce reliance on session stores, and let different tools validate users consistently. They’re particularly effective in setups involving embedded dashboards, federated APIs, and zero-trust architectures where verifying identity across systems is a regular part of the workflow.

That said, no single method is always right. JWTs are great when you need portability, statelessness, and embedded identity. Session cookies might still make sense in simpler web apps. API keys are fine for internal services with limited access needs. What matters most is choosing a method that fits the system you're building and understanding the trade-offs involved.

The power of JSON Web Tokens

Every system that connects people to data has to solve the same problem: how to know who you are and what you’re allowed to access quickly, reliably, and at scale. JWTs offer a practical way to make that happen. They keep things stateless, so services don’t have to coordinate session information. They’re portable, allowing authentication to travel with the request. They’re flexible, carrying just enough context to support decisions across dashboards, APIs, and automation workflows. But their strength depends on how they’re used. 

JWTs should be short-lived, securely stored, and signed with rotating keys. Payloads need to stay minimal. HTTPS is non-negotiable. When these pieces are in place, JWTs can be a trusted part of the architecture, doing their job quietly in the background.

As analytics tools spread across clouds, teams, and embedded use cases, JWTs help keep access consistent and secure without slowing things down. They aren’t magic, but they solve real problems cleanly. If you're working in data and haven’t thought much about authentication before, now’s the time. Understanding how your tools secure access and what JWTs are doing behind the scenes makes you better equipped to build systems that work safely.

JSON Web Tokens frequently asked questions

What is a JSON Web Token in simple terms?

A JWT is a small string of text that carries information about a user in a digitally signed format. It’s used to prove who someone is across different systems without needing a server to store session data.

How is JWT different from a session cookie?

Session cookies rely on server-side storage. When a user logs in, the server creates and stores a session, and the cookie references it. JWTs are self-contained. They carry all the information needed for authentication inside the token, so there’s nothing for the server to remember.

Can JWT be used for analytics dashboards and APIs?

Yes. JWTs are often used in analytics platforms to control access to dashboards, APIs, and reports. They make it easier to manage permissions across tools, especially when users need to move between services or access embedded content.

What happens if a JWT is stolen?

If someone gets access to a valid JWT, they can use it until it expires unless the system has built-in protections like short lifespans, refresh tokens, and proper key rotation. 

How do I revoke a JWT?

JWTs can’t be revoked in the same way as session tokens. Since they’re stateless, once issued, they stay valid until they expire. To limit exposure, keep tokens short-lived, rotate keys often, and use techniques like token blacklists or versioning if revocation is required.

THE STATE OF BI REPORT

No items found.