What is Passport
Laravel Passport is the official package for running a Laravel application as an OAuth2 authorization server. Use it for third-party app integrations and APIs that require a strict OAuth2 flow.Passport vs Sanctum
Choose Passport if OAuth2 is required. Choose Sanctum for simple API token authentication or SPA / mobile authentication.Installation
The official recommendation in Laravel 13 isinstall:api --passport.
Configuration
User model
Add theHasApiTokens trait and the OAuthenticatable interface to your User model.
auth guard
In theapi guard of config/auth.php, use the passport driver.
Service provider configuration
In yourAppServiceProvider’s boot() method, you can define scopes and token expirations.
Client management
Authorization code grant client
Client credentials grant client
EnsureClientIsResourceOwner middleware.
Token management
Granting scopes
Checking scopes
Revocation
Protecting API routes
Attachauth:api to APIs protected by user access tokens.
Personal Access Tokens
These are well-suited to cases where the user themselves issues an API token without going through the full OAuth2 flow.If Personal Access Tokens are your primary use case, Laravel itself officially recommends considering Sanctum.