What is Laravel Passport?
Answer
Laravel Passport is a full OAuth2 server implementation for Laravel. It is used when you need OAuth2 capabilities: issuing access tokens for third-party applications, supporting multiple grant types (Authorization Code, Client Credentials, Password, Implicit, Refresh Token), and building a platform where external developers authenticate via your API. Install: composer require laravel/passport, then php artisan passport:install (creates encryption keys and default clients). Issue tokens: $user->createToken("MyApp")->accessToken. Compared to Sanctum: Passport is heavier and appropriate for OAuth2 scenarios where you want to be an OAuth provider (like Google, Facebook). Sanctum is lighter and better for first-party SPAs and mobile apps where you control both the client and server. Most applications should start with Sanctum and add Passport only if they need OAuth2.
Previous
What is firstOrCreate and firstOrNew in Eloquent?
Next
What are sub-queries in Laravel Eloquent?