Hi Jacob,
Thanks for your answer.
To be honest I was hoping I can build my app serverless, but if I understand your answer correctly I have to have a server anyway just for creating and checking the custom tokens. Correct ?
OK, I see I may use providers like Auth0, but that is external provider, not part of Google Firebase. Just wondering, my understanding was Firebase is targeting for mobile/web/iots devices, serverless developments, but practically it is not possible to achieve this now ?
Btw I'm really beginner on this area, excuse me if I have stupid questions...
My plan is really looks as you have mentioned:
- The users are installing a nodejs app on their raspberry PI. The app can communicate with firebase and has a REST API available locally
- The users starting their mobile/web app, registering at Firebase using one of the standard methods
- The App scanning the local network, find the Pi. From the Pi local data the app can see it is a new device, never registered before.
- The user can "register" a new device in the FB database, getting a new key generated by FB, let say under the iots/ node, or similar.
- The app will get the key from FB, forward this key to the Pi, Pi will store it. From now it is a registered Pi device, belongs to a user.
- The Pi device have to log on the FB, watch for changes under iots/deviceId, and post new values to here as well.
- The user can see the values reported by his Pi devices in the app/web, realtime through FB , and can send messages to the units,
- etc...
In my test the PI devices authenticating themselves with user ID and pwd, but this should not be the case at a real app (?), and in this case I will not be able to setup proper authorisations and db validations. All Pi device can do what just want in the name of the user...
So any advise regarding the authentication, or regarding this scenario as well, welcome.
thanks in advance,
Sandor