简体   繁体   English

在 Firebase 身份验证中获取用户的 IP 地址的方法?

[英]A way to get the IP address of a user in Firebase Authentication?

Does Firebase log the IP address that the user last signed in from? Firebase 是否记录用户上次登录的 IP 地址?

The reason that I need it is that I want to try to broadly segment my users by location, and IP address will usually help with this.我需要它的原因是我想尝试按位置广泛细分我的用户,IP 地址通常会对此有所帮助。

But I'm not sure if the data exists in Firebase or is query-able.但我不确定数据是否存在于 Firebase 中或是否可查询。

Nope.没有。 Firebase Authentication does not make the IP address of the user available. Firebase 身份验证不会使用户的 IP 地址可用。 See Firebase JavaScript SDK - Retrieve Users IP Address请参阅Firebase JavaScript SDK - 检索用户 ZA12A3079E14CED426E69BA52B8A

But what you describe sounds like a use-case better suited to Firebase Analytics/Google Analytics for Firebase, which does expose the user's location (based on a lookup from their IP address).但是你所描述的听起来像是一个更适合 Firebase Analytics/Google Analytics for Firebase 的用例,它确实暴露了用户的位置(基于从他们的 ZA12A3079E14CED46E69BA52B8A90 查找)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM