Web Technology Basics

Which of the following correctly describes a typical signed JWT (JSON Web Token)?

  1. AThe payload is encrypted with the signing key, so passwords or credit card numbers put in it cannot be read along the way
  2. BEven after a token has expired, the server must accept it as long as the signature is valid, because it has not been tampered with
  3. CIt consists of a header, a payload and a signature, each encoded with Base64URL and joined with "."; the signature detects tampering, but the contents are not encrypted
Show answer and explanation

Answer: C. It consists of a header, a payload and a signature, each encoded with Base64URL and joined with "."; the signature detects tampering, but the contents are not encrypted

A JWT has three parts, "header.payload.signature": the header holds the signature algorithm (for example HS256), and the payload holds information (claims) such as the user identifier and the expiry (exp). The signature is made from the header and payload with a secret key, so a server that receives the token can confirm that the contents have not been tampered with and who issued it. However, Base64URL is not encryption, and anyone can decode and read it, so no secret information is put in it. When sent to an API, the token is generally placed after Authorization: Bearer.

  • A. The payload of a signed JWT is only encoded and can be read by anyone. Secret information is not put in it.
  • B. Along with the signature, the server checks the expiry (exp) and rejects expired tokens.
  • C. Correct. The signature detects tampering, but the contents are not encrypted.
Practice this topic Back to topic

Books on Web Technology Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Web Technology Basics questions

  1. A photo-printing app, with the user's permission, reads the user's photos stored on another company's photo storage service. In OAuth 2.0, which of the following roles shows the user a screen asking for permission and, when the user agrees, issues an access token to the app?
  2. Which of the following correctly describes the relationship between OAuth 2.0 and OpenID Connect?
  3. Which of the following is an appropriate web API design that follows the principles of REST?
  4. A browser opens https://www.example.com:8443/docs/guide.html?lang=ja#install. Which part of this URL is not included in the request sent to the server and is used only inside the browser after the page loads?
  5. To put the Japanese character "あ" into a URL query, the byte sequence representing it in UTF-8 (E3 81 82) is percent-encoded. Which of the following is the correct result?