I've decided to use JWT and completely remove Laravel Passport from the project.
I was trying to start with composer remove laravel/passport
. However, it does no good:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Laravel\Passport\Passport' not found
Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1
Removal failed, reverting ./composer.json to its original content.
What could be the right and safe removing procedure?
You can easily remove Sanctum by running composer remove , and commenting out or remove the api/user endpoint in your api route file. // routes/api.
You can remove passport by manually deleting this line "laravel/passport": "^4.0"
in your composer.json
file then run composer update
.
If you're running Laravel 5.4 or below, make sure to remove this line in your app.config
file Laravel\Passport\PassportServiceProvider::class
And all classes that relies on passport must be edited as well. The most common classes are:
User
model, remove the HasApiToken
trait.AuthServiceProvider
, remove Passport::routes();
in your boot method.config/auth.php
, change your driver option for api
authenticationIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With