Home > database >  Is there any way to get lastSignInTime on Firebase Auth by using user UID?
Is there any way to get lastSignInTime on Firebase Auth by using user UID?

Time:10-29

I am looking to fetch lastSignInTime for all users by using the UID of the users.

I am using react.js

I have attached a screenshot of it so that you will have an idea of what I am looking for.

Hope, you guys help me out with this.

enter image description here

CodePudding user response:

There is no way to access profile information about other users than yourself from within the client-side SDKs of Firebase Authentication.

If you need such information in your app, the two main options are:

  1. Write the information to a cloud-based database (such as Firebase's own Realtime Database or Firestore) when they sign in, and read it from there.
  2. Use the Admin SDK to access this information for all users in a trusted environment, such as a server you control or Cloud Functions. From there you can then expose the information to your ReactJS application as a custom API.,

In both cases, be sure to take care of securing access to the information, by limiting the amount of data you expose and who can access it.

  • Related