### Publish Passport Migrations Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md Command to publish Passport's database migration files to your Laravel application. ```bash php artisan vendor:publish --tag=passport-migrations ``` -------------------------------- ### Laravel Passport API Documentation Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md Documentation for Laravel Passport's API, covering route management, grant type enablement, and model customization. ```APIDOC Passport API: Route Management: - registersJsonApiRoutes: Boolean - Description: Controls whether the deprecated JSON API routes are registered. - Default: false - Usage: Set Passport::$registersJsonApiRoutes = true; in AppServiceProvider::boot(). Grant Types: - enablePasswordGrant(): void - Description: Enables the password grant type for authentication. - Usage: Call Passport::enablePasswordGrant(); in AppServiceProvider::boot(). Model Customization: - Overriding Models: - Description: Customize database connections or timestamps for Passport models like Token. - Reference: https://laravel.com/docs/9.x/passport#overriding-default-models Database Schema Changes (oauth_clients table): - Columns replaced: - user_id -> owner_type, owner_id - redirect -> redirect_uris (stores array of URLs) - personal_access_client, password_client -> grant_types (stores array of grant types) - Factory Update: Laravel\Passport\Database\Factories\ClientFactory has been updated. An old factory class is available for use if changes are not desired. ``` -------------------------------- ### Handling OAuthServerException Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md This documentation explains that when rendering OAuth exceptions, `LeagueOAuth2ServerExceptionOAuthServerException` should now be checked as an instance of `LaravelPassportExceptionsOAuthServerException` in your exception handler. ```APIDOC OAuth Exceptions: When rendering OAuth exceptions, check for `Laravel\Passport\Exceptions\OAuthServerException` instead of `League\OAuth2\Server\Exception\OAuthServerException`. ``` -------------------------------- ### Enable JSON API Routes Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md Allows continued use of the deprecated JSON API by setting a configuration flag in the AppServiceProvider. ```php public function boot(): void { Passport::$registersJsonApiRoutes = true; } ``` -------------------------------- ### Dropping Personal Access Client Table Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md Illustrates the SQL schema command to drop the `oauth_personal_access_clients` table. This table is no longer used by Passport and can be safely removed. ```APIDOC Schema::drop('oauth_personal_access_clients'); ``` -------------------------------- ### Handle OAuthServerException in Exception Handler Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md This guidance explains how to adjust exception handling for OAuth errors. If you were previously catching `LeagueOAuth2ServerExceptionOAuthServerException`, you should now catch `LaravelPassportExceptionsOAuthServerException` instead. ```PHP // Example of how to check for the Passport-specific exception if ($exception instanceof LaravelPassportExceptionsOAuthServerException) { // Handle Passport OAuth server exceptions } ``` -------------------------------- ### Hashing Client Secrets Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md Provides the Artisan command to hash existing client secrets in Laravel Passport. This command ensures that all client secrets are stored securely using Laravel's hashing mechanism. ```Shell php artisan passport:hash ``` -------------------------------- ### Laravel Passport Middleware Renaming Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md Lists the renamed middleware classes in Laravel Passport. These changes reflect a clearer naming convention for middleware functionality related to token and scope checking. ```APIDOC Middleware Renames: - Laravel\Passport\Http\Middleware\CheckScopes -> CheckToken - Laravel\Passport\Http\Middleware\CheckForAnyScope -> CheckTokenForAnyScope - Laravel\Passport\Http\Middleware\CheckClientCredentials -> CheckToken - Laravel\Passport\Http\Middleware\CheckClientCredentialsForAnyScope -> CheckTokenForAnyScope - Laravel\Passport\Http\Middleware\CheckCredentials (abstract) -> ValidateToken ``` -------------------------------- ### Run Passport Hash Artisan Command Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md This command hashes all existing client secrets in the database using Bcrypt. It is a convenience command provided by Passport for enabling client secret hashing. A database backup is recommended before execution. ```CLI php artisan passport:hash ``` -------------------------------- ### Configure Personal Access Client Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md This snippet shows how to configure your personal access client ID and secret in the `.env` file and register these values within the `boot` method of your `AppServiceProvider`. This is a prerequisite for enabling client secret hashing. ```php PASSPORT_PERSONAL_ACCESS_CLIENT_ID=client-id-value PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET=unhashed-client-secret-value ``` ```php Passport::personalAccessClientId(config('passport.personal_access_client.id')); Passport::personalAccessClientSecret(config('passport.personal_access_client.secret')); ``` -------------------------------- ### Enable Password Grant Type Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md Enables the password grant type for Passport authentication by calling a specific method in the AppServiceProvider. ```php public function boot(): void { Passport::enablePasswordGrant(); } ``` -------------------------------- ### Customizing Authorization View Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md Demonstrates how to customize the authorization view rendering logic in Laravel Passport by specifying a custom view name. This is typically done within the `boot` method of the application's `AppServiceProvider`. ```PHP use Laravel\Passport\Passport; public function boot(): void { Passport::authorizationView('auth.oauth.authorize'); } ``` -------------------------------- ### Enable Client Secret Hashing Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md This code enables client secret hashing by calling `Passport::hashClientSecrets()` in your `AppServiceProvider`. It also includes the Artisan command to hash existing client secrets, with a warning about the irreversible nature of this operation. ```php Passport::hashClientSecrets(); ``` ```bash php artisan passport:hash ``` -------------------------------- ### Disabling UUID Client Identification Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md Shows how to retain the use of incremental integer IDs for clients in Laravel Passport by setting the `clientUuids` static property to `false`. This configuration should be placed in the `boot` method of `AppServiceProvider`. ```PHP use Laravel\Passport\Passport; public function boot(): void { Passport::$clientUuids = false; } ``` -------------------------------- ### Update OAuth Clients Table for Public Clients Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md This code snippet modifies the `secret` column of the `oauth_clients` table to be nullable. This change is necessary to support public clients and the PKCE (Proof Key for Code Exchange) flow. ```PHP Schema::table('oauth_clients', function (Blueprint $table) { $table->string('secret', 100)->nullable()->change(); }); ``` -------------------------------- ### Make Secret Column Nullable for Public Clients Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md This code snippet updates the `secret` column in the `oauth_clients` table to be nullable, which is required to support public clients and PCKE (Proof Key for Code Exchange) in Passport. ```php Schema::table('oauth_clients', function (Blueprint $table) { $table->string('secret', 100)->nullable()->change(); }); ``` -------------------------------- ### Add Provider Column to OAuth Clients Table Source: https://github.com/laravel/passport/blob/13.x/UPGRADE.md This code snippet demonstrates how to add a nullable 'provider' column to the 'oauth_clients' table in your database schema. This change is necessary for Passport's support of multiple guard user providers. ```php Schema::table('oauth_clients', function (Blueprint $table) { $table->string('provider')->after('secret')->nullable(); }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.