Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kmavrakis's avatar

Laravel 5.4 Auth Login doesn't work when the project is cloned in another computer!

Hey all!

I've setup an 5.4 Laravel project and have implemented the basic Laravel Auth for an already existing database. On my mac mini, the login form works as intended. It checks the Users table, for the provided username & password (the only modification to the Auth controller etc), and logins the user. When I clone the repo on my macbook air, the login doesn't work. I've issued:

php artisan key:generate #also used the key that was generated on my mac mini
php artisan migrate
php artisan db:seed
php artisan config:cache
composer dump-autoload

but the login form returns These credentials do not match our records..

I'd really appreciate any feedback.

Thanks in advance.

0 likes
8 replies
bobbybouwmann's avatar

I think it has something to do with the APP_KEY. Your passwords are encrypted using the application key. So when you run php artisan db:seed and you create a user and the bcrypt method for example it will generate a hash based on the APP_KEY and the given password. So it's important to use the same key here!

Are you sure you're using the same key? Also if you have a clean database and run db:seed the key shouldn't matter when you clone it again since it will insert a new hash anyway.

How does your users seeder look like? Maybe you have a small mistake there?

shez1983's avatar

i dont know what you are getting to - but he is clearling seeding/migrating usin the new APP_KEY so as long as his password is same e.g test1234 on both places.. it should work.

did you do composer install by any chance?

Cronix's avatar

i dont know what you are getting to

I think he means that if you create users in one laravel application (storing the hashed password), and then try to validate a user using a 2nd application (using same db of users that were created from the first app), the APP_KEY needs to be the same in both applications since hashing the password uses the APP_KEY.

Snapey's avatar

ignoring the previous data for a moment, can you register a user and login on your new environment?

kmavrakis's avatar

The thing is that I've modified the Auth controller to accept plain text passwords and username instead of email. (Please, don't ask why...) therefore, I don't think that APP_KEY might be an issue. Also I've been asked to disable Register therefore I can't try to see if this works.

The Users seeder is just username, password and other columns not required by the Login.

bobbybouwmann's avatar

So before you continue! And I seriously mean this! Refactor back to hashed passwords! This is unacceptable in 2017!

Anyway, we need to see some code to see what's going on here. If you use plain passwords it should always work (again not a fan). There might be something you forgot to commit before cloning or something else is not configured correctly!

Let me know if I can help you any further!

Snapey's avatar

Plain text passwords is irresponsible.

shez1983's avatar

@Cronix i doubt he is using the same DB since he has migrated/seeded the data on his laptop...

and yes some code would be nice seeing as we all (i presume) clone repo at work/home etc and it all seems to work fine..

Please or to participate in this conversation.