每个提供商的 firebase 用户 ID 是唯一的(facebook、twitter、密码) [英] is firebase user id unique per provider (facebook, twitter, password)

查看:36
本文介绍了每个提供商的 firebase 用户 ID 是唯一的(facebook、twitter、密码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果在 firebase 中允许多个身份验证提供程序(twitter、facebook、密码),最好以这种方式存储用户:

If allowing multiple auth providers in firebase (twitter, facebook, password), is it best to store users in this manner:

/users/[auth.id]_[auth.provider]/...

/users/[auth.id]_[auth.provider]/...

看起来基于提供者的 auth.id 可能有重叠.

It looks like there could be overlap in auth.id based on the provider.

大多数示例的安全文件只检查 auth.id.我试图避免创建自己的用户 ID 的复杂性.

Most of the examples have the security file only checking auth.id. I'm attempting to avoid the complexity of creating my own user ids.

想法?

推荐答案

是的,如果您通过 Simple Login 使用多个身份验证提供程序,建议像您一样使用提供程序作为前缀或后缀.auth.id 仅保证在同一提供程序中是唯一的.

Yes, if you're using multiple auth providers with Simple Login, it's recommended to prefix or suffix them with the provider, as you have. auth.id is only guaranteed to be unique within the same provider.

Firebase 现在在 auth 对象上提供了一个 uid 参数,该参数保证在提供者之间是唯一的.例如,请参阅任何简单登录提供程序的身份验证后",例如 电子邮件/密码

Firebase now provides a uid parameter on the auth object, which is guaranteed to be unique across providers. For example, see "After Authenticating" on any of the simple login providers, such as email/password

这篇关于每个提供商的 firebase 用户 ID 是唯一的(facebook、twitter、密码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆