How to authenticate to a Firebase database using Android Things?

人盡茶涼 提交于 2019-12-08 04:55:52

问题


I am starting to experiment with Android Things and I am trying to connect my app to a Firebase Realtime Database in a secure way.

The problem is that Firebase Authentication is not available in Things because it requires user interaction.

I don't want to leave my data public, so is there a way to authenticate to a Firebase Database using something like an API key?


回答1:


On Android Things, you can still do anonymous auth and email/password auth. With email/password, you can create a special account for your Thing in the console, and use those credentials to log in. The downside is that you're either baking the password into the Thing, or finding a way to get a hold of them that's somehow more secure.




回答2:


You can use a normal android app and communicate with your things app using Nearby2.0 API of google. So now like this you can pass email id and password as payload in a decodable encrypted form to your things app from the normal android app. So no need to use anonymous auth at all. Once you passed the credentials save it in sharedpref in things app and reuse as needed.

Hope this helps you. Thanks!




回答3:


In Android Things, Firebase Authentication is supported. See this link for more info.



来源:https://stackoverflow.com/questions/46044932/how-to-authenticate-to-a-firebase-database-using-android-things

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!