I Made a Laravel Authentication With ChatGPT and Reviewed it
This video will show you how I used ChatGPT to generate a Laravel Sanctum API Authentication. After creating the code, I decided not to make any changes. I recently created a Laravel Sanctum API Authentication tutorial where I created an authentication using Laravel Sanctum. After I generated the ChatGPT code, I decided to do a side-by-side comparison to see the difference.
I have made this tutorial to show young developers that you shouldn’t blindly copy-paste code from ChatGPT, especially not when it comes to security. Once you watch the video, you will see that ChatGPT generates ‘ok’ code, but there are a lot of flaws. Here is my short summary:
- ✅ Good for explanations for a specific topic
- ✅ Good to check if you have missed a configuration step
- ✅ Good if you know what needs to happen so you could make changes to the code
- ❌ Bad for authentication because validation is incomplete
- ❌ Bad if you are an inexperienced developer that does not know what needs to happen
- ❌ If you need the most up-to-date code since data is coming from 2021, which is using Laravel 8 data
📲 Let’s plan a meeting
Plan a (paid) 1-hour meeting on Calendly to do portfolio reviews, code reviews resume reviews or a coaching session for Laravel: https://calendly.com/codewithdary
💌 Newsletter
Sign up for my free weekly email newsletter: https://newsletter.codewithdary.com/
📚 New Udemy Course
If you're looking to level up your Laravel skills, my new course "Udemy Migirations, Seeders, Factories, Query Builder, Eloquent & Relationships" is the perfect opportunity. Learn the essential tools and techniques for building robust and scalable web applications with Laravel: https://www.udemy.com/course/mastering-laravel-10-query-builder-eloquent-relationships/?referralCode=C784C3DB5B8925207FCB
🔗 Useful links
- Laravel Sanctum Tutorial: https://www.youtube.com/watch?v=TzAJfjCn7Ks
- Laravel Sanctum Source code: https://github.com/codewithdary/laravel-sanctum-tutorial
🔥 Resources
- Twitter: https://twitter.com/codewithdary
- Instagram: https://www.instagram.com/codewithdary/
- Blog: https://blog.codewithdary.com/
- Patreon: https://www.patreon.com/user?u=30307830
- GitHub: https://github.com/codewithdary/
- TikTok: https://www.tiktok.com/@codewithdary
📋 Table of Content
00:00 - Introduction
01:13 - Asking ChatGPT how to create a Laravel app
02:47 - Asking ChatGPT how to set up our database
04:55 - Asking ChatGPT what the best Authentication Scaffolding is
07:28 - Asking ChatGPT how to install Laravel Sanctum
09:19 - Asking ChatGPT to generate a LoginController
11:39 - Asking ChatGPT to generate a RegisterController
12:58 - Performing the requests in Postman
14:17 - Code Comparison
#laravel #chatgpt