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

查看:100
本文介绍了使用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中的上次登录时间和创建时间:

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.lastSignInDate Auth.auth().currentUser.metadata.creationDate

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

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