使用 Firebase 3 从 FIRUser 获取创建日期和上次登录日期 [英] Get Created date and last login date from FIRUser with Firebase 3

查看:26
本文介绍了使用 Firebase 3 从 FIRUser 获取创建日期和上次登录日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想通过 firebase 获取用户的创建日期和上次登录日期,我的计划是让用户使用 Facebook 登录,然后注册并添加新信息并将用户保存在实时数据库中创建日期和上次登录日期,那么如何在保存它们后使日期与 Firebase 系统不同步,或者我应该只使用那些 f FIRUser 而不要将它们保存在实时数据库中

I just want to get the created date and the last sign in date of a user with firebase, my plan is to let user login with Facebook and then signup and add new information and save the user in the real time database with the created date and last login date, so how to keep the date un sync with the Firebase system after saving them, or should I just use those f FIRUser and do not save them in the real time database

问题 1:如何从仪表板中显示的 FIRUser 获取创建日期和上次登录日期(见附图)

Question 1: how to get the created and last login date from FIRUser like displayed in the dashboard (see attached image)

问题 2: 一旦我得到这些日期,我会将它们保存在实时数据库中,那么如何保持上次登录日期的同步?

Question 2: Once I get those dates I will save them in realtime database, so how to keep the last sign in date in sync ?

推荐答案

从 4.4.0 版本开始,您可以从 currentUser 获取 iOS 中的最后登录时间和创建时间:https://firebase.google.com/support/release-notes/ios#4.4.0

You can, starting with version 4.4.0, get the last sign in time and creation time in iOS from the currentUser: https://firebase.google.com/support/release-notes/ios#4.4.0

Auth.auth().currentUser.metadata.lastSignInDateAuth.auth().currentUser.metadata.creationDate

这篇关于使用 Firebase 3 从 FIRUser 获取创建日期和上次登录日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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