-
Notifications
You must be signed in to change notification settings - Fork 389
fix(auth): Add lastRefreshTime to UserMetadata toJSON method. #889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(auth): Add lastRefreshTime to UserMetadata toJSON method. #889
Conversation
It's returned from the server in a different format than the other timestamps. Fixes #887
Note the diffbase. (Will retarget to master after that other one lands) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is confusing. Why not put all the fixes in one PR. They are closely related.
go/small-cls? But more relevantly, my fix for the importing one isn't working and will take a bit longer than these two more trivial ones. |
…ta_tojson_lastrefreshtime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good. Some minor nits.
}); | ||
const expectedMetadataJSON = { | ||
lastSignInTime: new Date(expectedLastLoginAt).toUTCString(), | ||
creationTime: new Date(expectedCreatedAt).toUTCString(), | ||
lastRefreshTime: new Date(expectedLastRefreshAt).toUTCString(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are lacking test cases for lastRefreshTime
. Most existing test cases only check for the other 2 fields. We might want to address that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the code now (2y later) I see some test cases for this, but perhaps not as many as there should be. I think that's independent of this PR though.
@@ -80,6 +80,7 @@ function getValidUserResponse(tenantId?: string): GetAccountInfoUserResponse { | |||
validSince: '1476136676', | |||
lastLoginAt: '1476235905000', | |||
createdAt: '1476136676000', | |||
lastRefreshAt: '2016-10-12T01:31:45.000Z', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to this PR. But are the fields like createdAt
actually sent as strings (quoted), not numbers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah they are all sent as strings. Here is a snippet:
"lastLoginAt": "1590622314664",
"createdAt": "1590545248026",
"lastRefreshAt": "2020-05-28T01:44:39.262Z"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks good from my end.
@rsgowman do you know the status of this fix? I am using the RTDB Admin SDK and am still not receiving the lastRefreshTime. |
…ta_tojson_lastrefreshtime
@cainenielsen sorry, looks like this stalled out. Let me see if I can update it and find the right person to approve it. |
Since specifying this when importing users isn't supported.
02031d1
to
f072d6b
Compare
@lahirumaramba, could you review this old PR (or redirect appropriately)? Thanks! |
@rsgowman Thank you for surfacing this. LGTM. I will merge this. |
See #887