JWT How to login with username or with phone and not with email?

I have:
$credentials = request([‘email’, ‘password’]);
and it works:
auth()->claims($customClaims)->attempt($credentials)
I want to login user with unique ‘phone’ from table users.
How to tell JWT to use another column when it make attempt ?

Hi @evrica.vit,

I’m not sure I understand your questions completely, but if you are asking how to login without an email, you will have to do that via passwordless at this time.

See this post:

Thanks!
Dan

Finally solved with:
$credentials = ['phone'=>$request->phone, 'password'=>$request->password];
See here https://github.com/tymondesigns/jwt-auth/issues/1974#issuecomment-619368408

1 Like

Thanks for sharing your solution!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.