Hello!
I built an ESP32 data logger with firebase connection that works fine.
The logger authenticates with user email/password and receives the UID to send its data.
Now I want to send data into the users RTDB without knowing its credentials (not programmed into the code).
The RTDB UID is not sufficient for a write, the device needs to be authenticated first.
Any suggestions how to solve this?
Thank You
Andreas
Hi.
I’m sorry, I’m not sure that I understood your question.
Do you want to be able to write to the database without the need to use a username and password? Or you don’t want to use the user UID?
You can enable authentication for an anonymous user. See how we did it in this project: https://randomnerdtutorials.com/esp32-firebase-realtime-database/#create-firebase-project
In the case of an anonymous user, you need to allow access to anyone to the database, so that you can use the database as an anonymous user.
Let me know if this helps or if you need further help.
Regards,
Sara
Hi Sara,
thank You. My clarification:
The device belongs to the user. It should add data autonomously to the users RTDB and WebApp. However, I don’t want to “hardcode” the User login credentials into the code, so that the user can change his password.
I hoped that the database UID would be sufficient to write the RTDB, but it needs an authentication with email/pwd.
So question is: how can the device be authorized to write into the users RTDB (without knowing his email credentials).
The anonymous user is not a feasible solution, unfortunately.
Thank you for any idea 🙂
Hi.
Unfortunately, I’m not sure if that’s possible.
I found this discussion that may give you some ideas: https://stackoverflow.com/questions/64407702/do-users-need-to-create-an-account-to-read-write-to-firebase
Regards,
Sara