get the user credentials, find their entry in users, check that they are ok and force the login with Auth::login($userID)
https://laravel.com/docs/5.2/authentication#other-authentication-methods
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm trying to implement a very simple authentication for my app but not sure how to override the custom authentication system. What should happen is the database is queried to see if the users machine is listed - If it is, the user should be logged in.
I tried using the Auth facade like I would normally use but it looks like it depends on a password.
public function login()
{
$hostname = get_hostname(); // helper method to get hostname of machine
if (Auth::attempt(['hostname' => $hostname])) {
return redirect()->intended('home');
}
}
The error is
ErrorException in EloquentUserProvider.php line 116:
Undefined index: password
Again there is not hashed passwords to compare which is normally the second value in the passed array. Is there a simple way to implement what I'm trying to do?
If that is all you need, just check whether the such a user exists and login him in yourself
$hostname = get_hostname();
$user = findUserByHostame($hostname); // Something like User:: where() or whatever depending on your impl.
if($user) {
Auth::login($user);
return redirect()->intended('home');
}
Please or to participate in this conversation.