Add API key authentication, registration and login to a REST API using the Slim PHP micro framework.
Please consider supporting my channel:
☕ https://ko-fi.com/davehollingworth
This is a follow-up video to this video: • REST API with PHP and MySQL | Full Sl...
Topics covered:
• How to pass API keys to the API: query string and X-API-Key header
• Using middleware to require an API key
• PHP templates
• Signup and login
• Hashing
• Encrypting
• Custom validation with Valitron
• Session middleware
All source code shown is free to download:
‣ https://github.com/daveh/slim-api-aut...
Previous video's code:
‣ https://github.com/daveh/slim-rest-ap...
Links shown in the video:
‣ https://www.slimframework.com/
‣ https://github.com/slimphp/PHP-View
‣ https://watercss.kognise.dev/
‣ https://github.com/vlucas/valitron
‣ https://www.php.net/manual/en/functio...
‣ https://acte.ltd/utils/randomkeygen
‣ https://github.com/defuse/php-encryption
Videos:
‣ Signup and Login with PHP and MySQL
• Signup and Login with PHP and MySQL
‣ Send email with PHP
• Send email with PHP | Create a Workin...
‣ Encrypt and Decrypt Data Securely in PHP
• Encrypt and Decrypt Data Securely in ...
00:00 Introduction
00:59 Require API key middleware
05:24 Use X-API-Key header
07:28 Move routes to separate file
08:43 Add homepage
12:36 Use PHP view templates
15:05 Add signup page
18:24 Process signup page
19:11 Validate signup data
23:47 Hash password
24:08 Generate API key
24:48 Add user table to database
25:29 Add user repository
26:51 Save user to database
27:56 Authenticate API with user's key
30:16 Hash the key in the db
33:11 Add login page
35:00 Process login page
36:29 Session middleware
38:06 Login and logout
39:53 Add profile page
41:25 Require login middleware
42:54 Encrypt API key
47:31 Add signup success page
49:05 Custom email validation
50:37 Summary
#PHP #slim #project #api #restapi #authentication
Watch video REST API Authentication with PHP & MySQL | Slim PHP Micro Framework Registration and Login Tutorial online without registration, duration hours minute second in high quality. This video was added by user Dave Hollingworth 24 April 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 6,051 once and liked it 167 people.