我有一个使用 Firebase 和用户身份验证的 Android 应用。身份验证过程通过 Facebook、Google 或 Twitter 帐户完成,并将用户数据存储到 Firebase。
另一方面,我有一个在 App Engine 中运行的 Java 版 Google Cloud Endpoint,它连接到 Firebase 以检索一些数据,并最终通过 Google Cloud Messaging 向其他用户发送消息。Firebase 存储用户 GCM 令牌,如果某些 GCM 令牌无效或已更新,端点连接到 Firebase 以将这些 GCM 令牌更新到用户节点。
现在,我的用户节点安全规则如下:
"rules": {
"users": {
".read": "auth !== null",
"$uid": {
// grants write access to the owner of this user account whose uid must exactly match the key ($uid)
".write": "auth !== null && auth.uid === $uid"
目前,不允许 Google Cloud Endpoint 更新用户 GCM 令牌,我正在考虑在 Endpoint 中实现一个身份验证过程,该过程会生成一个自定义令牌,只是为了允许端点写入用户节点。
这是要走的路吗?还是我完全错了?