I am trying to implement firebase's signInWithPhoneNumber just to verify user's phone number without really registering which I can not bypass. But the problem is that it excecutes the onAuthStateChanged function which then logs the user out since it is not possible to link email with phone number accounts.
I also did read the documentation about linking the already registered(user with email) with phone but without success.
So my question is, is there any way I can detect which auth provider is in onAuthStateChanged just to return the function or is there possibility to link email with phone?
Any help is appreciated! If code needed just ask.
Firebase Auth doesn't have a mechanism to just verify a phone number without also signing in - that's just not a supported use case. You might want to look into other products that do phone number or SMS validation. Firebase Auth is just for managing actual user accounts for the people using your app.
Related
Instead of using the normal firebase authentication methods I want to use web3 (specifically metamask) to provide signup/login without the need of email and passwords. The problem is, how do I handle signups?
One way I thought of doing it would be to use the users wallet address as the email and just add my domain as the # part for example: 0x0000000000000000000000000000000000000000#example.com but then the problem is how do I add a password for firebase to use?
Is there anyway to authenticate using metamask?
I wish I had seen this question earlier, We have developed a mechanism just for this requires a server that runs the firebase-admin that mints a custom token and pass it to the client and signs in with signInWithCustomToken.
The code is here https://github.com/novum-insights/sveltekit-unlock-firebase.
This is a boilerplate that uses sveltekit and paywalls the user with unlock-protocol.
I'm a newbie in React Native and struggling in handling the state of authentication in my app.
I'm using Redux and haven't persisted the authentication state to silently log user in yet. I've added Firebase authentication
Basically what I want is when a user signs in, he will be signed out by the app when that same account signs in in a different device.
Or at least, can we disable the activity of the old user ?
Can anyone please guide me stages and requirements in order to achieve this ?
Thanks in advance!
You can not automatically signout the other/old user but check the authentication token while calling any API by the old user.
While you are logging in from a new device just generates an authentication token on firebase. And from the very next pass that token through header while calling any API.
This is the logic.
How do I can secure Cloud Firestore without any auth uid.
Why without ?
Because I have a simple chat application and I am not storing their auth uid while they register.
Also they can open their app after first registration without any login so I dont know how can I understand who is logged in already and then let them to read or write operations.
Therefor I want to secure Cloud Firestore without any authentications.
Any help if is it possible ??
First, you have to ask the question, "How can firebase detect that your user is after login part of the app?"
I would recommend not to throw auth away, but when you want to get rid of any email and password auth, you can use anonymous login or custom auth system that Firebase is providing.
Firestore security rules have just simple things provided that will not help solve your problem. You have request object that is providing auth, time, type, etc. and resource object that is providing firestore document data. None of those will help you.
I am working on a college app in which only the administrator has the right to create user accounts. On successful User Account creation, the user gets an email with his user email and password as plain text.
I am already familiar with the email verification and password reset mail in firebase but I am not allowed to do that.
I already looked at answer to this question: Send User Password via Email with Firebase but it is very less helpful as the answer provided is complicated to understand.
So all I want is the password to be sent via email whenever a user is created.
PS: I am working with Web Interface (JavaScript). How do I do that? It would be even nice if I get help with some code chunks included.
You can achieve this using firebase cloud functions following the steps below
Setup Admin SDK following the documentation https://firebase.google.com/docs/admin/setup
Add a Firebase Authentication Listener https://firebase.google.com/docs/functions/auth-events
You can send mail with sendgrid See this article
If you want to really get familiar with cloud functions you can start here
I am having issues figuring out how to implement the functionality for my current tasks. I will try to explain the situation simply:
The app is an Angular 2 webapp that uses Firebase for authentication. when the app loads up, the user is automatically authenticated anonymously (since we have database and file storage rules that are set to "auth != null".
Then later in the app there is a feature that the user can only use when authenticated through an auth provider (Google). If I try to just sign in with Google it saying that the user is already signed in.
So we can sign out, and then try to authenticate with Google. But then what if the user closes the auth popup box or denies giving the app permissions? Then the user is not authenticated at all!
And if we re-authenticate anonymously if the Google sign-in fails then we have a completely different username (created from the uid) which is very weird UX for the user.
Perhaps I am not thinking about it correctly, but I just don't see any good solution for what I'm trying to do. Hopefully, someone else can find a better solution. Thanks!