Closed pocha closed 8 months ago
We have to use custom auth flow for Firebase authentication
We need to use Firebase function with admin SDK which the frontend will call to check if kilvish id provided is present in DB & if the phone number & email matches. The function will also create the firebase token & send it back to frontend.
The frontend will use signInWithCustomToken function to register the user & login process will be done.
I think, in case of kilvish id not found (user is new), we should send different OTP to phone number & email ..
Phone OTP message should say 1234-xxxx
& Email OTP message will say xxxx-5678
. The OTP field on the UI where user need to enter will have hint text xxxx-xxxx
& title says PhoneOTP-EmailOTP . So we do not need to create two input fields.
For subsequent logins, we should send same OTP on email & phone number & the field should just say OTP. User can enter any OTP.
Firebase project link
Currently the signup screen is dummy. The user signup should happen with Firebase. A new user entry should be created in Firebase authentication DB with the user's phone number, email & kilvish id. There should be provision of OTP authentication.
If a user already registered with different phone number / email tries to authenticate/signup, an error should be thrown with popup showing obfuscated email & phone number associated with the kilvish id & telling user to use those values.