troubleshooting Question

Laravel 8 Custom Password Field For Authentication

Avatar of Scott Fell
Scott FellFlag for United States of America asked on
2 Comments1 Solution20 ViewsLast Modified:
I have an old app I am trying to port to Laravel 8.  I am trying to use the built in authentication methods without using any of the starter kits or building models.

In the folder app/config/auth.php I have set my users provider for the database.
  'providers' => [
        //'users' => [
        //    'driver' => 'eloquent',
        //    'model' => App\Models\User::class,

        'users' => [
             'driver' => 'database',
             'table' => 'tLogin',
The password field is not 'password' and I am trying to figure out how to override using the default 'password' name.

As an example, for the login controller, I am getting an error that 'password' does not exist. 

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class LoginController extends Controller

     * Handle an authentication attempt.
     * @param  \Illuminate\Http\Request $request
     * @return \Illuminate\Http\Response
    public function authenticate(Request $request)
        $credentials = $request->only('username', 'password');

        if (Auth::attempt($credentials)) {

            return redirect()->intended('login');

        return back()->withErrors([
            'email' => 'The provided credentials do not match our records.',

Should I instead use something like below where I can grab the field names I need for $email and $password like below?
if (Auth::attempt(array('email' => $email, 'password' => $password)))
{    return Redirect::intended('dashboard');

I am just trying to avoid creating models in Laravel as this is an old project already with a lot of data and I feel like it would be faster to go around that.
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros