tymondesigns / jwt-auth

🔐 JSON Web Token Authentication for Laravel & Lumen
https://jwt-auth.com
MIT License
11.28k stars 1.55k forks source link

Basic Auth with JWT without Dingo or Passport #1513

Open seatechdev opened 6 years ago

seatechdev commented 6 years ago

Subject of the issue

I am looking for some help to enable Basic Auth with JWT without Dingo or Passport support. This is done to build a web client without using Angular or another javascript framework. Right now in every controller, I am using the middleware as follows: class SomeController extends Controller { public function __construct() { $this->middleware('jwt.auth', ['except' => ['someothercontroller']]); } }

Question: Is there a way to put the JWT middleware in the routes instead of the controller so that I can run both basic and JWT auth on the app.

airguillaume commented 6 years ago

Hi there :)

Route::group(['middleware' => ['jwt.auth']], function() { Route::get('logout', 'AuthController@logout'); Route::get('test', function(){ return response()->json(['foo'=>'bar']); }); });

josh9060 commented 6 years ago

I don't understand?

You want to use JWT Auth and Laravel's basic Auth?

seatechdev commented 6 years ago

Yes. The reason is that I don't want to use a javascript based framework such as angular for my desktop. Even though it is much easier for it to do it at this point.