2021年1月1日星期五

Extract Created date and last login from firebase authentication using Python

Currently my python code gets the user id and email of all users from firebase authentication using the firebase admin SDK, however I am unable find the correct syntax to extract the user metadata such as the created and last login date/time (which according to the documentation is in milliseconds). There are a few documentation that shows ways to do this, but it is not working for me.

My code:

from firebase_admin import credentials  from firebase_admin import auth    cred=credentials.Certificate('firebasesdk.json')  firebase_admin.initialize_app(cred, {      "databaseURL": "myurl",  })    page = auth.list_users()      while page:          for user in page.users:              print('User email: ' + user.email)              print('User id: ' + user.uid)  

I tried using user.metadata.creationTimeand user.madata.getLastSignInTimestamp and but it does not work with python. I was looking through this post regarding this issue.

https://stackoverflow.com/questions/65535902/extract-created-date-and-last-login-from-firebase-authentication-using-python January 02, 2021 at 11:59AM

没有评论:

发表评论