In firebase, how do you read the value of the users' "Created in" metadata?

Asked

Viewed 92 times

0

I intend to get the date of creation of the user registration in the application, to compute a trial period. I thought about creating a Function cloud to feed a variable with this value, which would be perfect for new cases, but it wouldn’t do any good for the nearly 270 users in production. However, I saw that in the panel already exists such date and I would like to get this data. How I can access this data?

Print do console

2 answers

1

You can capture this data using firebase CLI with the command:

firebase auth:export account_file --format=file_format

where account_file is the name of the file where the data will be saved and file_format the file type, can be CSV or JSON. The results for JSON are more or less like this:

  {"users": [...
  {"localId": "key",
  "email": "[email protected]",
  "emailVerified": false,
  "passwordHash": "hash==",
  "salt": "salt==",
  "lastSignedInAt": "1504893158000",
  "createdAt": "1504558948000",
  "providerUserInfo": []
  }
  ...]}

Firebase auth

0

You can use the Firebase Admin SDK to get the date. But it is not possible to use it on android. I believe that for new users you do with Metadata, and create a simple java program using the SDK and feeds this database.

Just commenting, it is not possible to use on Android for two reasons:

  1. If you add such an SDK into an app for the general public, you will empower them to manage your infrastructure.

  2. The package names for both platforms are equal, and you would have conflicts on android.

Admin SDK also has a version for Node.js, so I think you can use cloud functions as well (correct me if I’m wrong)

  • In fact only Firebase Admin SDK for Nodejs platform supports user management. https://firebase.google.com/docs/admin/setup?hl=pt-br

Browser other questions tagged

You are not signed in. Login or sign up in order to post.