dusterio / lumen-passport

Making Laravel Passport work with Lumen
MIT License
654 stars 139 forks source link

NotFoundHttpException #160

Closed MikeAlbela closed 3 years ago

MikeAlbela commented 3 years ago

Hi guys, I followed every step on the instruction from installation to User model but when I tried to access it http://localhost:8000/oauth/token it is showing me error 404 NotFoundHttpException. I am pretty sure I've done everything on the instruction but one thing I am not sure of is the registering the routes, what I did is put this "\Dusterio\LumenPassport\LumenPassport::routes($this->app);" in the boot() function in AuthServiceProvider.php file

santilorenzo commented 3 years ago

You need to put this line in the AuthServiceProvider:

use Illuminate\Support\ServiceProvider;
public function boot()
{
        LumenPassport::routes($this->app->router);
}
MikeAlbela commented 3 years ago

Hello, I already have that, here's my AuthServiceProvider but I still have the same error

image

image

Thank you

santilorenzo commented 3 years ago

Did you uncomment/insert these lines in bootstrap/app.php?

$app->register(App\Providers\AuthServiceProvider::class);
$app->register(\Laravel\Passport\PassportServiceProvider::class);
$app->register(\Dusterio\LumenPassport\PassportServiceProvider::class);
MikeAlbela commented 3 years ago

Yes, I did uncomment those lines in bootstrap/app.php but still it's showing error 404 when I tried to access http://localhost:8000/oauth/token to generate a key.

MikeAlbela commented 3 years ago

Finally solved the issue. Seems like the instructions are bit incomplete if it's being followed by a newbie in lumen/laravel like me. This link helped me to solved the issue: https://medium.com/@misteryomi/integrating-laravel-passport-in-your-lumen-project-with-example-1c2b8719c30