Im trying to log in a system user without sessions or cookies.
The following code in my middelware works unless the user id is from a system user:
$interface_token = $request->header('token');
if ($interface_token !== 'my_secret') {
return response('Unauthorized', 401);
}
$user_id = 1; // Just for testing. Here I want to login a system user.
$success = Auth::onceUsingId($user_id);
if (!$success)
{
throw new Exception('failed!');
}
I want to log in a system user since this specific routes are going to be call from an internal service not from a "real" user.
If I update the table users setting the system_user = 0 of user id 1, it works.
If system_user = 1 then it doesn't authenticate.
Is it possible to authenticate a system user?
I'm using Laravel 5.4
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2urFgtw
via IFTTT
Aucun commentaire:
Enregistrer un commentaire