How to check if user has valid token in controller without auth middleware in routes file? I try to do it this way in Basecontroller but it always return false:
protected function isAuthenticated()
{
$isAuth = auth('api-web-app')->check();
Log::info($isAuth);
if( $isAuth ) {
Log::info(auth('api-web-app')->check());
}
else {
Log::info(auth('api-web-app')->check());
}
}
There is api-web-app guard in auth.php config file
'api-web-app' => [
'driver' => 'jwt',
'provider' => 'customers',
'hash' => false,
],
so I expected it will run the same logic as auth middleware, but it seem it is not.