Firebase 身份验证日志 - GCP

Firebase Auth Logs - GCP

是否可以检索有关用户登录或注销平台的日志?并将它们作为 Cloud Functions 日志发送到 stackdriver? 谢谢

Is possible to retrieve the logs about when a user is log-in or log-out to the platform?

遗憾的是,Firebase 不提供此类信息。要解决这个问题,您应该创建自己的机制来跟踪用户的登录和注销。

您可以使用 REST API 为 Firebase 身份验证启用 Activity Logging。这些文档为 Firebase 身份验证和 Google Cloud Identity Platform 使用的身份工具包 API (identitytoolkit.googleapis.com) 启用日志记录。

您检索 REST 的授权令牌的一种更简单的方法 命令是让项目所有者使用 OAuthPlayground 并授权 这 Identity Toolkit API v3 范围

启用 Activity 日志记录后,您将能够在 Google 云日志记录 (StackDriver) 中查看 these logged operations。现在您将能够看到成功和不成功的登录请求,例如SignInWithPassword 用于电子邮件+密码身份验证,SignInWithIdp 用于联合登录请求,例如 Google SignIn。查看特定用户请求的一种方法是过滤日志以仅包含特定 jsonPayload.response.email

注意: 启用 Activity Logging will not enable Google Cloud Identity Platform for the project, so your project will continue to be subject to Firebase Auth Billing and not Google Cloud Identity Platform Billing.

需要注意的一件事是,如果您有大量用户,或者对您的项目非常重要 activity,您可能还希望 specify exclusions 尽量减少 cost/traffic/noise.