Home  >  Q&A  >  body text

php - Laravel5.4中JWTAuth::attempt认证失败?

在做laravel5.4中的jwt认证登录时,登录认证失败,注册认证成功.

调试代码时发现是JWTAuth::attempt($credentials)认证失败,值为false;
当我使用postman发送请求时是这样的
登录请求:


下面是我的配置文件

这是web.php文件

这是AuthController

这是MyUser (Model)

我觉得问题的根本就出在JWTAuth::attempt($credentials)

世界只因有你世界只因有你2712 days ago482

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