Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Course Overview: JSON Web Token (JWT) Authentication with Node.js


    In this course, we will build a simple authentication server that will act as a token issuer, and we will use those tokens to access resources on an API. Starting from scratch, the participants will learn how easy token based authentication can be and will understand how to use them on their APIs as well as on the front end of their web applications.



    Become a Member to view code

    You must be a Pro Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    orLog In




    Instructor: Hey everyone, welcome to this course on JSON web token authentication with Node.JS. The goal of this course is to introduce you to web-based authentication using JWTs.

    Through these few lessons, we will build a simple application that will connect to a secured API and we will build an authentication server to provide us with tokens that we need in order to connect and access those routes.

    We will start slowly by building a simple web server using Express. We will then see how to make this API more flexible by introducing environment variables, and then how to handle post request, and how to parse the body of those requests.

    At this point, we will be able to start building our authentication server. The server will validate the user credentials and provide those users with a JSON web token. Using this token, we will be able to go back to our API and secure one of our routes so that only an authenticated user can access those resources.

    Finally, what would a back-end be without a good UI? We will build a quick front-end that will connect to our API. This UI will also collect user credentials and send them over to the authentication server to fetch a JWT.

    All this will be done using plain old vanilla JavaScript and none of those fancy frameworks. This will give you all the necessary tools to implement this solution in any application you might build.

    Of course, the examples in this course will be simple, and we will focus more on the concepts rather than building a real secure API. For that reason, we will also show you how to switch your primitive authentication server to use a proven solution.

    In this lesson, you will be introduced to Auth 0as a solution to provide secure identity management and federated log in to your users. Go ahead, watch this course, and learn how to build more secure applications right now.