Before creating this project, make sure that your local machine has PHP and Composer installed.
laravel new version 11 is just arrived. So I used here laravel 10. I will create a fresh laravel app.
composer create-project laravel/laravel:^10.0 laravel-api-jwt
Once the project has been created, start Laravel's local development server using Laravel Artisan's serve command:
laravel-api-jwt
php artisan serve
By default, your application's .env
configuration file specifies that Laravel will be interacting with a MySQL database and will access the database at 127.0.0.1
.
DB_DATABASE=laravel-api-jwt
Now you have to create a database by this name laravel-api-jwt
into your local machine xampp
server.
Once you have configured your MySQL
database, you may run your application's database migrations, which will create your application's database tables.
php artisan migrate
Then Complete this project Step by Step in the Below:
- JWT Authentication Setup
- Create Register API with full Validated
- Create a Register View with full Validated Form
- Create validated Login API and generate JWT Token with response
- Integrate Login API in view, Store token in Local Storage
- Create Log out API and send response
- Integrate Log out API in Blade file
- Create Profile API and Integrate in Blade File
- Create Profile-Update API and Integrate in Blade File
- Create API for Email Verification, Use SMTP for send Mail, Routes setup for Mail Verification and Integrate in blade file
- Create Refresh Token API and Integrate in Frontend
- Create Forget-password API, send password reset token via mail
- Integrate Forget-password API in Frontend
- Set Custom JWT Token Expiration Times in different way
- Token expiration code, and auth redirect code