MockReal Logo
Home
BlogPricing
For Employers →
  1. Home
  2. Questions
  3. Explain how JWT works.

Explain how JWT works.

TechnicalSecurity Operations EngineerWeb Application Security EngineerIdentity and Access Management Engineer

JWT, or JSON Web Token, is a compact, URL-safe means of representing claims to be transferred between two parties. It consists of three parts: a header, a payload, and a signature. The header typically specifies the token type and the signing algorithm. The payload contains the claims, which are statements about an entity (usually the user) and additional data. Finally, the signature is created by combining the encoded header and payload with a secret key, ensuring the token's integrity.

JWTs are widely used for authentication and information exchange because they can be easily verified and trusted. For example, in a web application, after a user logs in, the server generates a JWT and sends it back to the client. The client can then include this token in the header of subsequent requests, allowing the server to authenticate the user without needing to store session data.

However, it’s important to consider the trade-offs. While JWTs are stateless and scalable, they can become large if the payload is extensive, and if compromised, they can be reused until they expire. In contrast, traditional session IDs stored on the server can be more secure but require server-side storage and management.

More Questions

  • Do you know how Single Sign-On works?
  • Explain how OAuth works.
  • What is the difference between authentication vs authorization name spaces?
  • Describe HTTPs and how it is used.
  • Describe SSL handshake.
  • Differentiate XSS from CSRF.
  • Do you know what XXE is?
  • Explain how you would build a web site that could secure communications between a client and a server and allow an authorized user to read the communications securely.
  • Explain man-in-the-middle attacks.
  • How can Github webhooks be used in a malicious way?
MockReal Logo

Spoken interview practice for technical professionals

Product

  • Pricing
  • Questions
  • Positions
  • Resumes
  • For Employers →

Company

  • Careers
  • About Us
  • Contact
  • Blog

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy

© 2025 MockReal. Spoken interview practice. All rights reserved.