Firebase auth using email/phone and passward - javascript

in my app at Login screen, I'd like to auth a user by two text inputs, where user could type either Email or Phone number, and password.
There's question, does it possible to auth user by phone and password? or phone auth uses by sending SMS code?

you can't use phone auth using web sdk.
It doesn't support it but native sdk does.
Using react-native-firebase, you can use native sdk(android, ios) with react-native.
react-native-firebase

Related

Email Sign in link - web client JavaScript | Firebase Authentication

I am developing a web-app that uses Firebase (web client JavaScript). For authentication, I am trying to implement sendSignInLinkToEmail to sign in a user. But, I’m facing an issue.
Suppose the user is trying to login on his desktop and uses his phone for verification, I want to redirect him to the dashboard on the desktop after verification. How can I do this?
Ref: https://firebase.google.com/docs/auth/web/email-link-auth
const actionCodeSettings = { url: 'dashboardURL', handleCodeInApp: true }
This redirects to the dashboardURL on the phone (device used for verification), but I want to redirect on the desktop (device that initiated the login flow).
Firebase Authentication does not natively support this. You'll be logged in on the device where you open the link. You'll have to build this functionality yourself and a simpler approach would be to use Cloud Functions and Realtime Database.
The flow would be like:
User clicks on "send link" and is redirected to a page that listens for updates in realtime database at a key (randomly generated session ID depending on your requirements).
When a logs in on another device, call a Cloud Function that generates a custom token for signing in and then emit it the first device via realtime database.
Log the user in with signInWithCustomToken().
This is just a simplified version of a system that might use websockets, session Ids and additional factors for security. You can also use Firebase Anonymous authentication to ensure only that user can this token using security rules.

Can Custom Authentication be made in Firebase

I am trying to use a 6 digit code to log-in a user.
The code is available for 20 seconds and is unique to every user.
Briefly explained:
User is already logged in on a mobile app
User press the button "Get Unique Code"
Then, user enter the code on a WebPage on his PC
If the code is correct, show data for that user
What am I asking is if there is way to properly authenticate the user who introduces that code correctly given that I have the userID and all the informations about the user?
I can try and "fake log-in" (display all the information for that user when the code is correct) but there are some issues with this and I would like to avoid it.
I am using Firebase Authentication and Firebase Firestore. JavaScript is used for Web.
You can implement any authentication scheme you want by creating a custom provider for Firebase Authentication.
See Authenticate with Firebase in JavaScript Using a Custom Authentication System and Creating Custom Tokens with the Admin SDK.
In this flow you:
Sign in the users yourself.
Create a custom token for those users in a trusted environment, such as a server you control, or Cloud Functions.
Pass that custom token to Firebase Authentication, which can then use it to identify the user, and secure access to Firestore, Storage, and Realtime Database.

Reset password in a P2P native app using only username

I'm about to develop a P2P native chat app for android using react native. I would like to log in my user by asking for a username and a password. In case the user forgets his password is there any way to reset it without create the user from the start and losing all the data stored in device like chats or contacts?

Firebase Phone Auth Resend SMS

With the javascript api, is there a way to 'resend' the verifcation sms text for Firebase SMS? I can't find a solution for javascript
Whenever you call firebase.auth().signInWithPhoneNumber(phoneNumber, appVerifier), Firebase will send an SMS to verify that the user has access to that phone number.
See the Firebase guide on sending a verification code to the user's phone and the reference guide on signInWithPhoneNumber.

Firebase phone auth without code verification nor recaptcha

I am new in firebase and I am trying to integrate my WordPress authentication with firebase auth. my aim is: "when User registers on wordpress, to create a user on firebase with phoneNumber authentication for mobile app", is there a way to do firebase phone number auth through web, without Recaptcha verifier nor SMS code verification.
I created firebase account with email and password, and tried to update the User phoneNumber but without success (tried updateProfile and updatePhoneNumber)
I welcome any other idea or method for this integration (firebase/wordpress user creation)
Thank you

Categories

Resources