Open MichaelSlatteryDev opened 2 years ago
I added a new method findUserByPhoneNumber
in the Authentication service to retrieve a user from Firebase by providing his phone number.
For doing so I used the getUserByPhoneNumber
method provide by Firebase admin SDK.
getAuth() .getUserByPhoneNumber(phoneNumber)
We can also get several users with the getUsers
method
getAuth() .getUsers([ { uid: 'uid1' }, { email: 'user2@example.com' }, { phoneNumber: '+15555550003' }, { providerId: 'google.com', providerUid: 'google_uid4' }, ])
I added a new method
findUserByPhoneNumber
in the Authentication service to retrieve a user from Firebase by providing his phone number. For doing so I used thegetUserByPhoneNumber
method provide by Firebase admin SDK.
getAuth() .getUserByPhoneNumber(phoneNumber)
We can also get several users with the
getUsers
method
getAuth() .getUsers([ { uid: 'uid1' }, { email: 'user2@example.com' }, { phoneNumber: '+15555550003' }, { providerId: 'google.com', providerUid: 'google_uid4' }, ])
Can you push your branch, and let's make a PR for this, then I will start mapping out what more we need for this feature that we currently know of.
The branch is already pushed : feat/get-user-by-phone-number
The branch is already pushed : feat/get-user-by-phone-number
You can open a PR and we can take a look at it and see if it needs more work or if we can merge it
I opened the PR.
For the followers feature in the future the backend needs to be able to use a phone number from a users contacts to fetch userIds. We store the users phone number with Firebase Authentication. It seems the userId across the backend and Firebase is the same so assuming we can fetch users from Firebase using their phone number it should then be simple to do the rest in the backend with the
findUserByIdOrFail
function.