search

Home  >  Q&A  >  body text

php - JWTAuth::attempt authentication failed in Laravel5.4?

When doing jwt authentication login in laravel5.4, the login authentication fails, but the registration authentication succeeds.

When debugging the code, I found that JWTAuth::attempt($credentials) authentication failed, the value is false;
When I use postman to send a request, this is what it looks like
Log in Request:

< /p>


The following is my configuration file

This is the web.php file

This is AuthController

< /p>

This is MyUser (Model)

I think the root of the problem lies in JWTAuth::attempt($credentials)

< /p>

世界只因有你世界只因有你2755 days ago529

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-05-16 13:10:25

    Now the problem has been solved.
    The reason is that when my postman sends routes, I log in using UserBk(model), but the registration is MyUser(model). The account I use to log in is the account in MyUser, which leads to the problem. , JWTAuth failed. So I logged in with the UserBk account, and then logged in and registered.
    What I still don’t understand now is that when I use MyUser, I define the use of MyUser (model) in jwt.php, then Why is my login still bound to UserBK(model)?

    reply
    0
  • Cancelreply