ArranJacques / laravel-aws-cognito-auth

An authentication driver for Laravel for authenticating users in AWS Cognito User Pools.
Other
74 stars 26 forks source link

Authentication Error #20

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hello,

I did a fresh install of Laravel 5.6 and included the package following the step by step directions on the main page. I also did the 'php artisan make:auth' to create the scaffolding. I created the LoginController code below, and after doing a login, I get an error:

"SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select * from users where email = 000@0000.com limit 1)".

What would be the cause of this or is this not the right way of using the "Auth::attempt([..]) ?

Thank you for your time.

LoginController

`<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Validation\ValidationException;

class LoginController extends Controller { /* -------------------------------------------------------------------------- Login Controller
This controller handles authenticating users for the application and
redirecting them to your home screen. The controller uses a trait
to conveniently provide its functionality to your applications.
*/

public function login(Request $request)
{

    Auth::attempt([
    'email' => 'xxxxx@xxxxx.xx',
    'password' => 'xxxxxxxxxx',
    ]);

}`
ArranJacques commented 6 years ago

Hi,

This is nothing to do with the package and is because you're using the the wrong credentials for your database.

Access denied for user 'homestead'@'localhost' means your access to your database is being denied.

You need to configure your database by adding the host, user and password to your application's config file.

You can read more about this in the official docs at the links below.

https://laravel.com/docs/5.6/database https://laravel.com/docs/5.6/configuration#environment-configuration