首页 文章

来自Google Cloud Endpoint的Firebase身份验证

提问于
浏览
1

我有一个使用Firebase和用户身份验证的Android应用 . 身份验证过程通过Facebook,Google或Twitter帐户完成,并将用户数据存储到Firebase中 .

另一方面,我在App Engine中运行了一个Java Cloud Endpoint,它连接到Firebase以检索一些数据,并最终通过Google Cloud Messaging向其他用户发送消息 . Firebase会存储用户GCM令牌,如果某些GCM令牌无效或已更新,则Endpoint会连接到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令牌,而我正在考虑在 endpoints 中实施身份验证过程,该过程生成自定义令牌只是为了允许 endpoints 写入用户节点 .

这是要走的路吗?或者我完全错了?

1 回答

相关问题