Reading-Notes

View the Project on GitHub MohammadAl-khatib/Reading-Notes

Authentication & Production Server

JSON Web Tokens

JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object.

When should you use JSON Web Tokens?

  1. Authorization
  2. Information Exchange

JSON Web Token structure:

Theses are the components of a JWT:

You can create and see how a JWT might look like here.

How do JSON Web Tokens work?

In authentication, when the user successfully logs in using their credentials, a JSON Web Token will be returned. Since tokens are credentials, great care must be taken to prevent security issues. In general, you should not keep tokens longer than required.

Whenever the user wants to access a protected route or resource, the user agent should send the JWT, typically in the Authorization header using the Bearer schema.

The following resources still need more investigation: