This lesson will cover API authentication using the Laravel Passport package. If you look at the Passport documentation, it is huge, and for someone new to API authentication, it would be hard to understand and use.
We have covered Sanctum, which I recommend using, so we will check the basics of Passport in this lesson.
You must understand that Passport is a server based on the OAuth2 standard. This standard isn't from Laravel or PHP. It's a general web standard for authentication applications.
The Laravel Passport is based on the PHP OAuth 2.0 Server. But that server follows the OAuth specification. You would need to learn these things if you wanted to look deeper into how OAuth works and how to use it elsewhere.
You can install Laravel passport using an artisan command install:api
and passing --passport
as an option.
php artisan install:api --passportphp artisan migrate
Next, you need to configure your application...