From the course: Angular: API Communication and Authentication

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

JWT (JSON Web Token) overview

JWT (JSON Web Token) overview

- [Narrator] Currently the API routes that we have implemented are not locked down and are accessible by any user. Typically authentication in your APIs will be a required feature, accepting requests by users that should have access. Using JSON web tokens, or JWTs for short, is a robust way to add authentication to your API. JSON web tokens is an industry standard that provides a safe and compact way for representing data transferred between two parties. JWTs can be verified because they are signed, typically using a secret with the HMACSHA-256 algorithm. There are three parts to a JSON web token. I'll separate it by a dot. The header, the payload, and the signature. The header will contain the algorithm with the token type. Typically the header for a JWT will look like this. Here it is specifying that the HMACSHA-256 algorithm was used, and the type is JWT. The payload includes claim information for an entity, which is most likely a user for your application. There are specific…

Contents