There are no commands defined in the "passport" namespace. When installing API Authentication In laravel
Asked Answered
C

7

15

I am getting below error when i run php artisan passport:install

[Symfony\Component\Console\Exception\CommandNotFoundException]
There are no commands defined in the "passport" namespace.
Cathrin answered 4/4, 2017 at 5:50 Comment(0)
L
36

For installing laravel passport make sure you add this line to config/app.php in the providers array (package service providers section):

Laravel\Passport\PassportServiceProvider::class,

Then install the package and migrate the database

composer require laravel/passport
php artisan migrate 
php artisan passport:install

Clearing out the cache is generally helpful first step when commands are not working, especially when you update anything in the config folder on .env files.

php artisan config:clear  
php artisan config:cache 

Config clear removes the configuration cache file. Config cache creates a new configuration cache file with the current settings. Config cache enables faster load times for your apps!

Limicoline answered 15/7, 2017 at 17:40 Comment(3)
that answer works for me, i think it is the right answer.Sunshine
This answer gives the best procedure. Worked for me.Meseems
When I put composer require laravel/passport I obtain Problem 1 - Conclusion: remove laravel/framework v5.5.48 - Conclusion: don't install laravel/framework v5.5.48 - laravel/passport v8.4.1 requires illuminate/http ^6.0|^7.0 -> satisfiable by illuminate/ How Can I install Passport?Venter
C
6

I got solution. After running following two commands every thing work fine.

php artisan cache:clear
php artisan config:cach
Cathrin answered 10/4, 2017 at 5:0 Comment(0)
N
4

I was searching for a solution for this and I found simple one that worked for me:

Add these lines to $commands array in app/Console/Kernel.php

    \Laravel\Passport\Console\InstallCommand::class,
    \Laravel\Passport\Console\KeysCommand::class,
    \Laravel\Passport\Console\ClientCommand::class,
Nickelodeon answered 20/2, 2019 at 16:57 Comment(0)
S
2

Just follow these steps:

  1. composer require laravel/passport. Once the installation finishes, add the following provider in the config/app.php file: Laravel\Passport\PassportServiceProvider::class,
  2. php artisan migrate
  3. php artisan passport:install
Strophanthus answered 9/9, 2021 at 17:4 Comment(3)
Steps 1, 3 and 4 worked for me to get it up, but not sure what step 2 requires?Boehmite
Basically you add the line of code in step 2 in your config/app.php file as part of the items in the providers array.Strophanthus
I got it now. It was in another answer. I went through your answer first! Think that step should be made clearer. Thanks thoughBoehmite
D
1

Try running composer require laravel/passport "~9.0" before running php artisan passport:install

Doris answered 28/5, 2021 at 21:21 Comment(0)
C
0

Here Is the solution of install Laravel passport with mongodb:

Just replace the Illuminate\Database\Eloquent\Model; with Jenssegers\Mongodb\Eloquent\Model in below files:

..\vendor\laravel\passport\src\Token.php,
..\vendor\laravel\passport\src\AuthCode.php
..\vendor\laravel\passport\src\Client.php
..\vendor\laravel\passport\src\PersonalAccessClient.php

and protected $table= "Table_name" variable with protected $collection="Table_name"

Channing answered 30/8, 2019 at 6:51 Comment(1)
Welcome to SO. Please can you explain why your answer is valid and not just provide the code.Wilterdink
A
0

For laravel 10 jus run the below command

composer require laravel/passport --ignore-platform-reqs
Armament answered 6/8, 2024 at 19:5 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.