Intermediate

Secure a PHP REST API with Sessions and Role Middleware

Bcrypt passwords, HttpOnly and SameSite session cookies, and two middleware functions that put access rules on the first line of…

  1. 1 Hash passwords with bcrypt
  2. 2 Configure the session cookie
  3. 3 Write the login endpoint
  4. 4 Add requireAuth and requireRole
⏱ 45 minutes
Start Guide