When using Socialite, magic links, or another form of passwordless authentication, Laravel complains that the password
field does not exist on the User
model. Common advice online is to either make the password column ->nullable()
, or generate a random password when users sign up.
However, there’s a cleaner solution. Simply override the $authPasswordName
property on the User
model.
class User extends Authenticatable
{
// Add this line
protected $authPasswordName = null;
}
Now you can use Auth::login($user)
to manually authenticate users without requiring a weird vestigial password field.