Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Treehouse

PHP User Authentication Course (How To)

via Treehouse

Overview

Learn how to implement a custom user authentication system that controls users access to web resources, using password hashing and JSON Web Tokens for security. The system lets users sign up, log in, and log out, limiting access to certain actions based on authorization.

What you'll learn

  • Authentication vs Authorization
  • Cookies vs. Session Storage
  • JSON Web Tokens (JWT)
  • Securing Passwords

Syllabus

What is Authentication

You may think that authentication is one of the easiest parts of your application, and yes, it can be. However, to do authentication correctly can be a very difficult thing. If you manage your passwords incorrectly, it opens you up to a huge security vulnerability that will cost you later on down the road. Learning about the basics is the first place to start.

Chevron 6 steps
  • Authentication vs Authorization

    2:11

  • Application Overview

    1:26

  • AuthN vs AuthZ

    3 questions

  • Cookies vs. Session Storage

    2:57

  • JSON Web Tokens

    1:54

  • Cookies vs Sessions

    5 questions

Building the Library

It is time to build the core of our application without any of the complexity of authentication or authorization. This stage is all about setting up the files we need for viewing our books and adding more to our list.

Chevron 10 steps
  • Building the Book List

    12:02

  • Adding Books

    3:38

  • HTTP Foundation

    4 questions

  • Modifying Books

    6:37

  • Edit Procedure

    2:44

  • Deleting Books

    1 objective

  • Book Rating System

    6:23

  • Accepting the Vote

    3:45

  • Refactoring

    1:46

  • HTTP Foundation

    1 objective

Adding Authentication to Your Application

We now have the core of our application built, however it is open to the world to use and edit/delete any book. We should set up some sort of authentication system to prevent this and allow a user to “own”!

Chevron 13 steps
  • Registration System

    6:08

  • Securing Passwords

    5:38

  • Login Systems

    4:53

  • Building a JWT

    4:52

  • Authentication Review

    5 questions

  • Working with Cookies

    4:24

  • Require Authentication

    5:22

  • Logging Out

    3:13

  • Flash Messages

    5:29

  • Cookies and Flash Messages

    3 questions

  • User Profile

    9:30

  • Reset Password

    4:42

  • Password Hashing

    1 objective

Setting up Authorization System

The last part of our project is a way to authorize a user to let them do things based on their role. We discussed in Stage 1 the difference between authentication, which we just finished, and authorization. We will now create the role of administrator who can manage users and edit and delete any book on the site.

Chevron 7 steps
  • Creating Helper Functions

    6:51

  • User Admin Panel

    11:03

  • Combine Functions

    1 objective

  • Adding Authorization Checks

    4:52

  • Update the Application

    6:46

  • Series Summary

    0:42

  • User Authorization Review

    10 questions

Reviews

Start your review of PHP User Authentication Course (How To)

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.