TypeError: Illuminate\Auth\SessionGuard::login(): Argument #1 ($user) must be of type Illuminate\Contracts\Auth\Authenticatable,, App\Models\Admin giv

TypeError: Illuminate\Auth\SessionGuard::login(): Argument #1 ($user) must be of type Illuminate\Contracts\Auth\Authenticatable,, App\Models\Admin giv

  1. Blog
  2. 15 November 2026
  3. 4 min read

Stefan Bogdanescu

Founder & Senior Architect

Fixing Auth::login() Type Errors When Using Custom User Models

You are encountering a runtime error because you are passing an instance of App\Models\Admin to the SessionGuard::login() method, but that method expects an object implementing the Illuminate\Contracts\Auth\Authenticatable interface. This is a common stumbling block for beginners implementing multi-guard authentication in Laravel. The type hint isn't just a suggestion; it's a strict contract that the framework enforces to ensure the guard can correctly manage session data and user roles.

Understanding the Contract

In Laravel, the Auth::guard('admin') instance is an implementation of SessionGuard. When you call its login() method, the signature looks roughly like this:

public function login(Authenticatable $user, ?int $minutes = null)

The first argument must strictly implement Illuminate\Contracts\Auth\Authenticatable. While your Admin model likely holds user data (email, password hash, name), if it does not explicitly extend an Eloquent model or implement the specific interface required by Laravel's auth system in a way that satisfies the guard, the type check fails.

However, there is a nuance here. In modern Laravel versions, any Eloquent model automatically implements Authenticatable because the Model base class includes it. If your Admin class extends Illuminate\Foundation\Auth\User or simply Illuminate\Database\Eloquent\Model, it should theoretically satisfy this constraint. The error message implies that from the guard's perspective, App\Models\Admin is not recognized as a valid user.

The Likely Culprit: Missing Traits or Interfaces

If your Admin model extends Eloquent\Model directly but lacks the HasApiTokens trait (which is unrelated here) or, more importantly, if you have accidentally created a custom interface that conflicts with the default one, issues can arise. But the most frequent cause for this specific error in a standard setup is often how the model is defined or how the guard is configured.

If your Admin model looks like this:

class Admin extends Model
{
    // ...
}

It should work. However, if you are using a custom User class that extends a different base or lacks the necessary traits, Laravel might not recognize it.

The Real Fix: Ensure Proper Inheritance

The most robust solution is to ensure your Admin model properly inherits from the standard Eloquent model and implements the contract implicitly via its inheritance chain. If you have customized the Authenticatable interface in your project (which is rare but possible), you need to align your Admin class with it.

More often than not, this error occurs because the developer creates a custom User model that extends Illuminate\Foundation\Auth\User, which is the recommended approach for multi-auth setups involving admin panels. If App\Models\Admin extends Illuminate\Foundation\Auth\User, it automatically implements Authenticatable.

If you are forced to use a custom model without extending User, ensure you explicitly import the interface if your project structure demands it, though standard Laravel usually handles this via inheritance.

Checking Guard Configuration

Another potential pitfall lies in the auth.php configuration file located at config/auth.php. You must define the 'admin' guard and map it to your Admin model class. If the guard is configured to look for a different model, or if the provider is not pointing to the correct user repository, the guard might fail to recognize the instance you are passing.

Ensure your configuration includes:

'guards' => [
    'admin' => [
        'driver' => 'session',
        'provider' => 'admins',
    ],
],
'providers' => [
    'admins' => [
        'driver' => 'eloquent',
        'model' => App\Models\Admin::class, // Ensure this matches your Admin model path
    ],
],

If the AuthServiceProvider is not registering these providers correctly, or if you are using a custom provider class that doesn't match the Admin model, the type check will fail.

Correcting the Controller Logic

Looking at your authenticate method, the logic for fetching and hashing the password is sound. The issue strictly lies in the Auth::guard('admin')->login($model) line. If the Admin model extends Model, it works. If you have added a custom property to Authenticatable that your Admin class misses, you might need to implement those methods manually, though this is highly discouraged.

The cleanest path forward is to verify that App\Models\Admin extends Illuminate\Foundation\Auth\User. This base class handles the Authenticatable contract for you and includes methods like getAuthIdentifierName() (defaulting to 'email') which the guard relies on.

If you cannot change the inheritance, ensure your Admin model implements the Authenticatable interface explicitly:

use Illuminate\Contracts\Auth\Authenticatable;

class Admin extends Model implements Authenticatable
{
    // ...
}

And ensure all required methods (getAuthIdentifier(), getAuthPassword(), etc.) are implemented or inherited. However, extending Illuminate\Foundation\Auth\User is the idiomatic Laravel solution that avoids these manual implementations entirely.

Our network