Provide Users With A JSON Web Token

Share this video with your friends

Send Tweet

In this lesson, we will build a token issuer that will return a JSON Web Token. This simple server will have a single endpoint for login that queries a list of users and returns a web token for the matching user.

jpbamberg1993
jpbamberg1993
~ 6 years ago

Why are you validating the passwords match? Why does that matter?

jpbamberg1993
jpbamberg1993
~ 6 years ago
Joel Lord
Joel Lord(instructor)
~ 6 years ago

I here, we validate that the user provided password matches the user password on the server database. This way, we are authenticating the user. Without a valid password, we are not serving a JWT so he can't login.

Brendan Whiting
Brendan Whiting
~ 6 years ago

What does sub mean where we sign the jwt?

Joel Lord
Joel Lord(instructor)
~ 6 years ago

sub stands for subject. Basically, it tells the JWT consumer "who/what this token is about". In most cases, it represents the user id.