I'm creating a RESTApi in laravel 5.3 along with my API I also make a web application for admin use. In this web app I'm using laravel's easy auth (php artisan make:auth) which work just fine, but before starting up my web app I use JWT auth for my RESTApi. Now when I try to get a user from a JWToken with this call
Auth:user()
It does not return the right user, it returns the user in my 'Admin' model. I have two model, User and Admin, where User is used for my API and Admin is for my web/admin app. Is there a way I can separate these two authentication so that I use easy auth for 'Admin' and JWT for 'User'?
In each my API controller I have this middleware in the constructor:
public function __construct()
{
$this->middleware('jwt.auth');
}
You can try my package for multi auth in laravel 5.3. https://github.com/Hesto/multi-auth