Get Created date and last login date from FIRUser with Firebase 3

后端 未结 4 1800
生来不讨喜
生来不讨喜 2020-12-18 09:23

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

4条回答
  •  盖世英雄少女心
    2020-12-18 10:00

    In FIRUserMetadata your can find both properties:

    creationDate

    /** @property creationDate
        @brief Stores the creation date for the corresponding Firebase user.
     */
    @property (copy, nonatomic, readonly, nullable) NSDate *creationDate;
    

    to access this property use

    let creationDate = Auth.auth().currentUser?.metadata.creationDate
    

    lastSingInDate

    /** @property lastSignInDate
        @brief Stores the last sign in date for the corresponding Firebase user.
     */
    @property (copy, nonatomic, readonly, nullable) NSDate *lastSignInDate;
    

    to access this property use

    let lastSignInDate = Auth.auth().currentUser?.metadata.lastSignInDate
    

提交回复
热议问题