Support the ongoing development of Laravel.io →
Authentication

Hello, All

I meet some problem about Laravel 5 auth.

I create project and want to use default auth for login, and my config/auth.php setting is


<?php

return [

	'driver' => 'eloquent',

	'model' => 'App\User',

	'table' => 'users',

	'password' => [
		'email' => 'emails.password',
		'table' => 'password_resets',
		'expire' => 60,
	],

];

Just as the default setting, and my model for users is also the default User.php in App/


<?php namespace App;

use Illuminate\Database\Eloquent\Model;

class User extends Model {

    //
}

The problem occurs when I login at default login page: {Domain}/auth/login

I enter correct email, password and then submit. The ERROR occurs:


ErrorException in EloquentUserProvider.php line 109: Argument 1 passed to Illuminate\Auth\EloquentUserProvider::validateCredentials() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\User given, called in /Sites/project/vendor/laravel/framework/src/Illuminate/Auth/Guard.php on line 397 and defined

I google these keywords but can not find out what's wrong.

Can anyone help me?

Thanks.

Last updated 2 years ago.
0

Try this for you model class declaration:

class User extends Eloquent implements UserInterface, RemindableInterface
0
<?php namespace App; use Illuminate\Auth\Authenticatable; use Illuminate\Database\Eloquent\Model; use Illuminate\Auth\Passwords\CanResetPassword; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; class User extends Model implements AuthenticatableContract, CanResetPasswordContract { use Authenticatable, CanResetPassword; protected $fillable = ['name', 'email', 'password']; protected $hidden = ['password', 'remember_token']; // Write your functions here } Try this. I also had the same issue.
0

Hey, for what it's worth, I ran into the exact issue when updating to laravel 5.1 (still running into in fact...). The user model was verbatim with what was in the laravel github repo. Everything is basically the same except for what was in my composer.json file.

Every time I do a composer update, it brings this error up unless I run a composer dumpautoload after updating. Still don't know the root of the cause, but this got things moving again.

-- Update --

Figured it out! I had a friggin' Model that was declaring itself as 'user'

In particular:

use Laravel\Cashier\Billable;
use Illuminate\Database\Eloquent\Model;
use Laravel\Cashier\Contracts\Billable as BillableContract;

class User extends Model implements BillableContract
{
    use Billable;

    protected $dates = ['trial_ends_at', 'subscription_ends_at'];
}

In other news, I am an idiot.

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

dognose24 dognose24 Joined 3 Jun 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.