Skip to content

Latest commit

 

History

History
119 lines (61 loc) · 5.5 KB

upgrade-8.x-9.0.md

File metadata and controls

119 lines (61 loc) · 5.5 KB

Upgrade Guide

General Notes

Upgrading To 11.0 From 10.x

Minimum PHP Version

PHP 8.0 is now the minimum required version.

Minimum Laravel Version

Laravel 9.0 is now the minimum required version.

Reverting Model DB Connection Customization

PR: laravel/passport#1412

Customizing model database connections through the migration files has been reverted. This was first introduced in this PR.

If you need to customize the database connection for a model you should override the models as explained in the documentation.

Allow Timestamps On Token model

PR: laravel/passport#1425

Timestamps are now allowed on the Token model. If you specifically didn't want these model's timestamps to be updated then you may override the Token model as explained in the documentation.

Refactor Routes To Dedicated File

PR: laravel/passport#1464

Passport's routes have been moved to a dedicated route file. You can remove the Passport::routes() call from your application's service provider.

If you previously relied on overwriting routes using routes($callback = null, array $options = []) you may now achieve the same behavior by simply overwriting the routes in your application's own web.php route file.

Stubbing Client In Tests

PR: laravel/passport#1519

Previously, a stubbed client created via Passport::actingAsClient(...) wasn't retrieved when calling the ->client() method on the API guard. This has been fixed in Passport v11 to reflect real-world situations and you may need to accommodate for this behavior in your tests.

Scope Inheritance In Tests

PR: laravel/passport#1551

Previously, scopes weren't inherited when using Passport::actingAs(...). This has been fixed in Passport v11 to reflect real-world situations and you may need to accommodate for this behavior in your tests.

Upgrading To 10.0 From 9.x

Minimum PHP Version

PHP 7.3 is now the minimum required version.

Minimum Laravel Version

Laravel 8.0 is now the minimum required version.

Old Static Personal Client Methods Removed

PR: laravel/passport#1325

The personal client configuration methods have been removed from the Passport class since they are no longer necessary. You should remove any calls to these methods from your application's service providers.

Upgrading To 9.0 From 8.x

Support For Multiple Guards

PR: laravel/passport#1220

Passport now has support for multiple guard user providers. Because of this change, you must add a provider column to the oauth_clients database table:

If you have not previously published the Passport migrations, you should manually add the provider column to your database.

Client Credentials Secret Hashing

PR: laravel/passport#1145

Client secrets may now be stored using a Bcrypt hash. However, before enabling this functionality, please consider the following. First, there is no way to reverse the hashing process once you have migrated your existing tokens. Secondly, when hashing client secrets, you will only have one opportunity to display the plain-text value to the user before it is hashed and stored in the database.

Personal Access Clients

Before you continue, you should set your personal access client ID and unhashed secret in your .env file:

PASSPORT_PERSONAL_ACCESS_CLIENT_ID=client-id-value
PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET=unhashed-client-secret-value

Next, you should register these values by placing the following calls within the boot method of your AppServiceProvider:

Passport::personalAccessClientId(config('passport.personal_access_client.id'));
Passport::personalAccessClientSecret(config('passport.personal_access_client.secret'));

Make sure you follow the instructions above before hashing your secrets. Otherwise, irreversible data loss may occur.

Hashing Existing Secrets

You may enable client secret hashing by calling the Passport::hashClientSecrets() method within the boot method of your AppServiceProvider. For convenience, we've included a new Artisan command which you can run to hash all existing client secrets:

php artisan passport:hash

Again, please be aware that running this command cannot be undone. For extra precaution, you may wish to create a backup of your database before running the command.

Client Credentials Middleware Changes

PR: laravel/passport#1132

After a lengthy debate, it was decided to revert the change made in a previous PR that introduced an exception when the client credentials middleware was used to authenticate first party clients.

Switch From getKey To getAuthIdentifier

PR: laravel/passport#1134

Internally, Passport will now use the getAuthIdentifier method to determine a model's primary key. This is consistent with the framework and Laravel's first party libraries.

Remove Deprecated Functionality

PR: laravel/passport#1235

The deprecated revokeOtherTokens and pruneRevokedTokens methods and the revokeOtherTokens and pruneRevokedTokens properties were removed from the Passport object.