Skip to content

Instantly share code, notes, and snippets.

@rogerwschmidt
Last active August 2, 2017 18:20
Show Gist options
  • Select an option

  • Save rogerwschmidt/41a5e519897804c7f6dda414f7ac230c to your computer and use it in GitHub Desktop.

Select an option

Save rogerwschmidt/41a5e519897804c7f6dda414f7ac230c to your computer and use it in GitHub Desktop.

User Authentication Instructor Notes

Objectives

  • Explain what authentication is.
  • Explain why authentication is important.
  • Use bcrypt to authenticate a user.
  • Explain what a claim is.
  • Explain what a JSON Web Token is.
  • Explain why a JSON Web Token is important.
  • Create a JSON Web Token for an authenticated user.
  • Explain what authorization is.
  • Verify a JSON Web Token to authorize a user.

What is authentication?

Turn to your neighbor and discuss what authentication is. Be prepared to share with the class.

Why is authentication important?

Turn to your neighbor and discuss why authentication is important. Be prepared to share with the class.

How do you use bcrypt-as-promised to authenticate a user?

On your slates, write down the code that compares a password hash to a plain text password. Assume that you have already gotten the hashed password from the database.

What is a claim?

Turn to your neighbor and explain what a claim is. Be prepared to share your answer with the class.

What is a JSON web token?

Turn to your neighbor and explain what a JSON Web Token is. Be prepared to share your answer with the class.

Why is a JSON Web Token important?

Turn to your neighbor and discuss why a JSON Web Token is important. Be prepared to share your answer with the class.

How do you create a JSON Web Token for an authenticated user?

  • On a slate, write code for a JSON Web Token for a user that is already authenticated.

Explain what authorization is.

  • Turn to your neighbor and explain what a authorization is.
  • What is a cookie?
  • How do you add a JWT to a cookie
  • Why do we use cookies and JWTs to authenticate?

Verify a JSON Web Token to authorize a user.

Write code that verfies if a JWT is valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment