Laravel Passport provides a full OAuth2 server implementation for your Laravel application. This guide shows you how to set up Passport for API authentication.
- Install Laravel Passport:
- Run
composer require laravel/passport
and follow the installation instructions.
- Run
- Run Passport Migrations:
- Run
php artisan migrate
to set up the Passport tables.
- Run
- Configure Passport:
- Add Passport’s service provider to your
config/app.php
and callPassport::routes()
in yourAuthServiceProvider
.
- Add Passport’s service provider to your
Setting up Laravel Passport allows you to implement robust API authentication using OAuth2.