I'm wanting to read the 'Created' timestamp (that is available in the Authentication > USERS section of the Firebase console) directly from the firebaseUser object within the run function of my Angular app using AngularFire.
e.g
FirebaseAuth.$onAuthStateChanged(function(firebaseUser) {
console.log(firebaseUser.created)
}
Is a timestamp present anywhere on the object? I'm trying to avoid invoking the database at this point.
Thanks for your help.
You can add creation date in your database when creating a new account:
Users
useruid <-- from the console
name: userx
email: userx@gmail.com
creationdate: 2018-02-10
useruid
name: usery
email: usery@gmail.com
creationdate: 2018-03-01
Also check this:
https://firebase.google.com/docs/reference/js/firebase.User
Or retrieve it using metadata
as stated here:
The date the user was created, formatted as a UTC string. For example, 'Fri, 22 Sep 2017 01:49:58 GMT'.
Or using the Admin SDK:
admin.auth().getUser(uid).then(function(userRecord) {
console.log("Creation time:", userRecord.metadata.creationTime);
});
https://firebase.google.com/docs/reference/admin/node/admin.auth.UserMetadata