Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

routes not mounted #8

Closed
rajaunleashed opened this issue Oct 17, 2016 · 25 comments
Closed

routes not mounted #8

rajaunleashed opened this issue Oct 17, 2016 · 25 comments

Comments

@rajaunleashed
Copy link

rajaunleashed commented Oct 17, 2016

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
Copy link

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
Copy link
Author

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

@paolopiccinini
Copy link

paolopiccinini commented Oct 18, 2016

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

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

@rajaunleashed
Copy link
Author

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
Copy link

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

@rajaunleashed
Copy link
Author

rajaunleashed commented Oct 18, 2016

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

here is my route.php

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
Copy link

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

@rajaunleashed
Copy link
Author

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

@rajaunleashed
Copy link
Author

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

@paolopiccinini
Copy link

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
Copy link
Author

ok Thanks alot. :)

@perogeremmer
Copy link

perogeremmer commented Jun 10, 2017

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
Copy link

desyncr commented Jun 10, 2017

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

@paolopiccinini
Copy link

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
Copy link

ronnie-depp commented Sep 7, 2017

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
Copy link

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

@ahmdabos
Copy link

ahmdabos commented Oct 28, 2017

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
Copy link
Owner

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

@ahmdabos
Copy link

lumen is 5.4 and lumen passport is latest

@galvaodev
Copy link

galvaodev commented Nov 10, 2017

I'm really having trouble @dusterio
lumen is 5.5

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

@natemacs
Copy link

natemacs commented Dec 3, 2017

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

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

@tshwangq
Copy link

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

@dusterio
Copy link
Owner

@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
Copy link

sanjukaniyamattam commented Feb 27, 2018

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
Copy link

this is the similar issue with routes and might help someone depending on thier versions of Lumen, LaravelPassport and LumenPassport:
#47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests