1 year ago

how to use api_token

Posted 1 year ago by emfpc

Got the api_token in the users table....with the documentacion I'm a little confuse. I'm trying to make my own middle ware that just check if the user is log in then he has acces to the route: (example) ApiTokenMiddleware public function handle($request, Closure $next) { $user = Auth::check(); if($user){ return redirect()->intended('hellow'); }


heres is the route:

Route::get('userinfo',function(){ return 'you got acces to the user table'; })->middleware('apitokenmiddleware:api');

*ApiToken is already in the kernel as apitokenmiddleware

what am I missing? I can get the User Table information regardless if I'm log out. Have no idea how to use the api_token when the user is created.

Please sign in or create an account to participate in this conversation.