Skip to content
KnowledgeCity

Angular Advanced: JWT Authentication

Learn what a JWT Tokens are and how you can use them for authentication
Preview the first lesson free — get full access to all 6 lessons.
Course: On-Demand
Advanced Provider Farhan Saleem  6 Lessons ·  28m  in English 

Course Description

As a developer, it’s important to be not only aware of the different authentication options, but also their strengths and any associated risks. In these lessons, we will look at some options that are available in the UI for implementing security, as well as security concerns to be aware of. Implementing authentication has to be done in a few parts—we will look at how to create a mock backend server response and how to use Angular to get the JWT token, store it in the browser session storage, and send it to the backend for all requests after that. You will also learn how to use a route guard to allow or deny access to routes using the authentication service. This is a popular pattern in UI applications for authentication that, as a developer, is very important to understand and be able to implement.

Security is of critical concern to all modern applications. In these lessons, you will learn how to work with JWT tokens, implement authentication, and store user credentials. You will also learn about the HTTP interceptor and use it to intercept HTTP requests and send the token back to the server for every request.

What You'll Learn

  • Use JWT tokens to implement authentication in Angular UI applications
  • Create a mock backend server response and retrieve the JWT token
  • Store the JWT token in the browser session storage and send it on subsequent requests
  • Build an authentication service that works with a backend that authorizes the user
  • Implement an HTTP interceptor to intercept requests and send the token to the server
  • Apply a route guard (auth guard) to allow or deny access to routes using the authentication service

Key Takeaways

  • JWT authentication is a popular pattern in UI applications for handling security.
  • Implementing authentication involves creating a mock backend response, obtaining the JWT token, storing it in browser session storage, and sending it on all following requests.
  • An HTTP interceptor can intercept HTTP requests and send the token back to the server for every request.
  • A route guard uses the authentication service to allow or deny access to routes.
  • Developers should understand the different authentication options along with their strengths and associated security risks.

Frequently Asked Questions

Who is this course for?

It is for developers who want to understand and be able to implement authentication in Angular UI applications, including working with JWT tokens, authentication, and storing user credentials.

What topics does this course cover?

It covers Angular authentication project setup, design options and considerations, building an authentication service, using JWT tokens with an HTTP interceptor, using an auth guard with authentication, and security concerns and risks.

What skills will I gain?

Skills include application security, authentication protocols, JSON Web Token (JWT), secure application development, security tokens, and web application security.

What will I learn about HTTP interceptors?

You will understand what HTTP interceptors are and how to use them to intercept HTTP requests and send the token back to the server for every request.

How is access to routes controlled in this course?

You will learn how to use a route guard (auth guard) to allow or deny access to routes using the authentication service.