dusterio / lumen-passport

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

routes not mounted #8

Closed rajaunleashed closed 8 years ago

rajaunleashed commented 8 years ago

Hi,

I followed all the steps but the routes are not mounted there in lumen route folder? I didn't understand this line? I think I am doing something wrong after the passport:install command.

"Adding this service provider, will mount the following routes:" What's the meaning of this line?

paolopiccinini commented 8 years ago

The route are mounted in Dusterio\LumenPassport\PassportServiceProvider. passport:install configure the keys to use when generating token. passport:migrate generate the db-table requred from passport.

rajaunleashed commented 8 years ago

can you give me whole source code of lumen with running passport please? I tried thrice time But I failed.

paolopiccinini commented 8 years ago

https://github.com/dusterio/lumen-passport/blob/master/src/PassportServiceProvider.php

you can find the passport source code in vendor/laravel/passport

rajaunleashed commented 8 years ago

When I am installing the package it shows me the following message after installation of package.

phpseclib/phpseclib suggests installing ext-libsodium (SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.) lcobucci/jwt suggests installing mdanter/ecc (Required to use Elliptic Curves based algorithms.) league/oauth2-server suggests installing indigophp/hash-compat (Polyfill for hash_equals function for PHP 5.5)

paolopiccinini commented 8 years ago

those are only suggestion package. Nothing blocking. you can install them if you want or not.

rajaunleashed commented 8 years ago

Thank you dear. I reached to the final stage. one more help please sorry for asking again and again.

here is my route.php

<?php

$app->post('/oauth/token', '\Laravel\Passport\Http\Controllers\AccessTokenController@issueToken');

it gives me the error. Class App\Http\Controllers\Laravel\Passport\Http\Controllers\AccessTokenController does not exist

how to access those classes as they are in vendor folder?

paolopiccinini commented 8 years ago

passport routes are already configured. You just have to use them. They are already registered

rajaunleashed commented 8 years ago

Just WoW brother Thanks alot. its magic 👯‍♂️ nothing to do. Thanks @paolopiccinini and @dusterio

rajaunleashed commented 8 years ago

How to issue token? Should I pass parameters with the the issueToken route?

paolopiccinini commented 8 years ago

For example set the verb as post and the request body as { "username" : "yourEmail@email.com", "password" : "yourPassword", "client_id" : "youClientId", "client_secret" : "yourClientSecret", "grant_type" : "password" } of course you have to save in the db a user with email = "yourEmail@email.com" and "password" = "yourPassword", and a client. You can read the doc for more info https://laravel.com/docs/5.3/passport#introduction

rajaunleashed commented 8 years ago

ok Thanks alot. :)

perogeremmer commented 7 years ago

hello, i already follow all the steps but i have same issue here, it brings me http not found exception._. can you help me? i can't access the token, everytime i want to get the token with post localhost:8000/oauth/token and raw body i can't. It bring me to http not found exception. What happened? i am using Lumen 5.4

desyncr commented 7 years ago

Did you registered the routes correctly? See https://github.com/dusterio/lumen-passport#registering-routes

paolopiccinini commented 7 years ago

you have to point in your application root

localhost:8000/oauth/token it's missing your app

localhost:8000/[app-root]/oauth/token

ronnie-depp commented 7 years ago

I'm having the same issue. I have tried Lumen 5.4 & 5.5. @desyncr I was unable to Register the Routes as you pointed out. Because when I pass $app to: Dusterio\LumenPassport\LumenPassport::routes($app); it gives me error saying $app is undefined. And when I replace $app with app() Dusterio\LumenPassport\LumenPassport::routes(app()); it says that group method is undefined in Dusterio\LumenPassport\LumenPassport::routes line#83 as $callback->group is replaced by Laravel\Lumen\Application->group()

@paolopiccinini how to get the Application-Root? Please point out.

PLEASE HELP @dusterio @kiddyatreides @rajaunleashed @andrew-s

tdavincci commented 7 years ago

try using Dusterio\LumenPassport\LumenPassport::routes($router); instead of Dusterio\LumenPassport\LumenPassport::routes($app);

ahmdabos commented 7 years ago

hello , i have same issue when i call http://localhost/lumen-app/public/oauth/token its give me NotFoundHttpException this is how i register the route in authServiceProvider: LumenPassport::routes($this->app);

dusterio commented 7 years ago

@ahmdabos what Lumen version are you using and what lumen-passport package version?

ahmdabos commented 7 years ago

lumen is 5.4 and lumen passport is latest

galvaodev commented 7 years ago

I'm really having trouble @dusterio lumen is 5.5

Class App\Http\Controllers\Dusterio\LumenPassport\Http\Controllers\AccessTokenController does not exist

natemacs commented 6 years ago

@jvgm @dusterio I'm having the same problem.

Class App\Http\Controllers\Dusterio\LumenPassport\Http\Controllers\AccessTokenController does not exist

tshwangq commented 6 years ago

got same issue, I've to downgrade to 0.2.0 to avoid this

dusterio commented 6 years ago

@tshwangq @jvgm @NathanMacedo hmm that's very strange - I tested on both 5.4 and 5.5, my route:list displays correct namespace: POST | /oauth/token | | \Dusterio\LumenPassport\Http\Controllers\AccessTokenController | issueToken

Are you sure you have the lastest Lumen Passport? There was an issue from another PR that I fixed recently.

If you are sure it's the latest version, can you show how and where you run LumenPassport::routes() call?

sanjukaniyamattam commented 6 years ago

Follow this link https://github.com/dusterio/lumen-passport

Only one change you have to do is in the Registering Routes Step

  1. Open AuthServiceProvider.php in your app/Providers folder, add use Dusterio\LumenPassport\LumenPassport;

  2. Inside the boot() function, add: LumenPassport::routes($this->app->router, ['prefix' => 'v1/oauth']);

Also in bootstrap/app.php by default below 2 lines will be commented $app->register(App\Providers\AppServiceProvider::class); $app->register(App\Providers\AuthServiceProvider::class); Just uncomment it.

===================================================

If your php artisan route:list is not working then

  1. Run composer require appzcoder/lumen-routes-list

  2. Add service provider into /bootstrap/app.php file. $app->register(Appzcoder\LumenRoutesList\RoutesCommandServiceProvider::class);

  3. Run composer dump-autoload

ronnie-depp commented 6 years ago

this is the similar issue with routes and might help someone depending on thier versions of Lumen, LaravelPassport and LumenPassport: https://github.com/dusterio/lumen-passport/issues/47