且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Firebase中手动查看经过身份验证的用户的显示名称?

更新时间:2023-12-02 14:39:16

Firebase用户的显示名称存储在哪里?

Where is the Firebase user's display name being stored ?

这是一个很好的问题,因为它隐藏在某处但不容易显示.

Well it's a good question because it's hidden somewhere but it's not easily displayed.

我可以登录Firebase控制台查看显示名称吗?

Can I login to the Firebase console to see the display name ?

您可以登录Firebase控制台,但看不到显示名称.

You can log in into the Firebase console but you won't see the display name.

防止2个用户使用相同的显示名称(用户名).

Prevent 2 users from having the same display name (username).

为此,一种解决方案是将所有用户名存储在Firebase实时数据库中的某个位置. (就像用户名的特定节点一样).然后,在代码中,您可以检查它是否已经存在,或者使用数据库安全规则来使已使用的用户名无效. 但是只有使用Firebase身份验证中的显示名称信息,您才能防止重复.

For this, one solution is to store somewhere in your Firebase realtime database all the usernames. (Like a specific node for usernames). And then either in code, you can check if it already exists or use database security rules to invalidate an already taken username. But only with the display name info from Firebase authentification you can't prevent duplicates.