joselfonseca / lighthouse-graphql-passport-auth

Add GraphQL mutations to get tokens from passport for https://lighthouse-php.com/
https://lighthouse-php-auth.com/
MIT License
231 stars 55 forks source link

how to verify phone number instead of an email #114

Closed PouyaPour closed 4 years ago

PouyaPour commented 4 years ago

hi in my program, we don't need email and work with phone number. before I implement this, I want to know that we have a ready solution for this work, right? thanks

joselfonseca commented 4 years ago

You can Update the schema to receive the phone number and implement this method in the user model

https://laravel.com/docs/7.x/passport#customizing-the-username-field

PouyaPour commented 4 years ago

thanks a lot, My problem is that how can create token after that phone number verified?

joselfonseca commented 4 years ago

After you implement that method and it returns the user object the flow continues normally and the token will be issued, that method just finds the user object by using a custom query like looking for it by phone number. the rest of the flow stays the same.