Skip to content
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

Merged
merged 5 commits into from Jun 23, 2022

Conversation

rsgowman
Copy link
Member

See #887

It's returned from the server in a different format than the other timestamps.

Fixes #887
@rsgowman
Copy link
Member Author

Note the diffbase. (Will retarget to master after that other one lands)

Copy link
Contributor

@bojeil-google bojeil-google left a 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.

@rsgowman
Copy link
Member Author

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.

@rsgowman rsgowman changed the base branch from rsgowman/lastRefreshTimeBug to master May 13, 2020 13:46
Copy link
Contributor

@hiranya911 hiranya911 left a 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(),
Copy link
Contributor

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.

Copy link
Member Author

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',
Copy link
Contributor

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?

Copy link
Contributor

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"

Copy link
Contributor

@bojeil-google bojeil-google left a 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.

@cainenielsen
Copy link

@rsgowman do you know the status of this fix? I am using the RTDB Admin SDK and am still not receiving the lastRefreshTime.

@rsgowman
Copy link
Member Author

@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.
@rsgowman rsgowman force-pushed the rsgowman/usermetadata_tojson_lastrefreshtime branch from 02031d1 to f072d6b Compare June 22, 2022 14:41
@rsgowman
Copy link
Member Author

@lahirumaramba, could you review this old PR (or redirect appropriately)? Thanks!

@lahirumaramba
Copy link
Member

@rsgowman Thank you for surfacing this. LGTM. I will merge this.

@lahirumaramba lahirumaramba merged commit cfea847 into master Jun 23, 2022
@lahirumaramba lahirumaramba deleted the rsgowman/usermetadata_tojson_lastrefreshtime branch June 23, 2022 18:19
@lahirumaramba lahirumaramba changed the title Add lastRefreshTime to UserMetadata toJSON method. fix(auth): Add lastRefreshTime to UserMetadata toJSON method. Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants