0

First please excuse my English, I'm french... Also, I must admit that I'm not a pro developer. The reason why I'm here.

I'm trying to build a Laravel app based on an existing database. The original app was built with Java, but I prefer Laravel.

I've installed Laravel UI which seems to work fine for the registration but when I try to log in with an imported user from the original database I get this error message "These credentials do not match our records" regarding the email I use.

I use the User model with : protected $table = 'my_users_table';

I tried to do this on auth.php

'users' => [
        'driver' => 'database',
        'table' => 'my_users_table',
    ],

But nothing worked. I'm sure I forgot something, but I don't know what...

Thank you all

Mitesh Rathod
  • 879
  • 5
  • 18
  • Hey @Gastono, Hope you have added password string when you import the user. if not, then please add password static string where you inserting records in the table. and then try to login, it will work!!! – Mitesh Rathod Oct 04 '22 at 14:20
  • Thank you @MiteshRathod ! Can you please explain how to do that? I'm really confused :( Thanks a lot ! – Gastono Oct 04 '22 at 14:32

2 Answers2

0

Laravel uses bcrypt() function to encrypt given password on login and register. To encrypt, laravel uses APP_KEY. If the imported user were imported in Java end, it's possible, that Java encrypted the password with different sault

  • Thank you @Alexey Khachatryan So can you please tell me what to do or what to look for and change? As I said, I'm not a pro but I can't afford a real developper! Thanks ! – Gastono Oct 04 '22 at 14:58
  • In java end try to find the place where java makes an encryption of the password. For first the algorithm it uses, then find a sault it uses. Then use the same hashing algorithm and sault in laravel end. That's it – Alexey Khachatryan Oct 04 '22 at 15:10
0

Try with this code...

$insert = array(
    'email' => 'john@example.com',
    'password' => bcrypt('password'),
);

User::create($insert);

Then try to login your credentials.

Hope it will helps you to solve your query!!

Cheers mate!!!

Mitesh Rathod
  • 879
  • 5
  • 18