auth0 / laravel-auth0

Laravel SDK for Auth0 Authentication and Management APIs.
MIT License
246 stars 135 forks source link

Issue with guards in middleware #372

Closed rajnarayan-pix closed 1 year ago

rajnarayan-pix commented 1 year ago

Laravel Version

Laravel 9.x

SDK Version

SDK 7.6

PHP Version

PHP 8.3

What happened?

I was trying to use the this sdk , after setting up as explained in read me, i used it in my web route group for Stateful application as explained i put the guard in middleware as follows :

Route::group(['namespace' => 'App\Http\Controllers', 'middleware' => ['workspace', 'guard:auth0']], function () { Route::get('/import', "ImportController@show"); }); but this is not working, ending up in redirect loop

after seeing code examples i changed as follows :

Route::group(['namespace' => 'App\Http\Controllers', 'middleware' => ['workspace', 'auth0.authenticate']], function () { Route::get('/import', "ImportController@show"); });

and then it started working as expected

Please either change your read me, or else fix the behaviour to suit the read me :)

How can we reproduce this issue?

Just follow the read me and setup middleware in routes as follows :

Route::group(['namespace' => 'App\Http\Controllers', 'middleware' => ['workspace', 'guard:auth0']], function () { Route::get('/import', "ImportController@show"); });

Additional context

No response

evansims commented 1 year ago

Hi @rajnarayan-pix 👋 Sorry for any confusion, but I think you misunderstood what the README was suggesting. That is not how the README suggested you should configure your routes.