我想通过REST api在桌面应用程序中使用Firebase实时数据库(而非Cloud Firestore)。该应用程序是用C ++编写的,我不需要任何用户身份验证(如谷歌或Facebook登录),但我想保护我的数据库,所以我需要匿名身份验证。
最佳做法是什么?我无法找到有关此事的任何信息。
答案 0 :(得分:1)
您始终可以使用REST API登录匿名用户并获取Firebase ID令牌以用于数据库。 以匿名方式登录: https://firebase.google.com/docs/reference/rest/auth/#section-sign-in-anonymously
将经过身份验证的请求发送到db: https://firebase.google.com/docs/database/rest/auth#authenticate_with_an_id_token