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_time in Auth Emulator. #3674

Merged
merged 2 commits into from Aug 13, 2021
Merged

Fix auth_time in Auth Emulator. #3674

merged 2 commits into from Aug 13, 2021

Conversation

yuchenshi
Copy link
Member

@yuchenshi yuchenshi commented Aug 13, 2021

Description

Fixes #3671.
Fixes #3663.
Fixes #3673.

Date parsing is hard. This was broken in #3611. I've added comments and assertions for the details.

Scenarios Tested

Tests added in #3611 was also wrong and I've fixed that as well. Again, date parsing is hard.

Sample Commands

N/A

@@ -1755,6 +1750,27 @@ function generateJwt(
return jwtStr;
}

function getAuthTime(user: UserInfo): Date {
if (user.lastLoginAt != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!==

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentional since it can be undefined. TS won't let me do !== null

throw new Error(`Internal assertion error: invalid user.lastLoginAt = ${user.lastLoginAt}`);
}
return authTime;
} else if (user.lastRefreshAt != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@yuchenshi yuchenshi merged commit a390f9e into master Aug 13, 2021
@mikehardy
Copy link

Thanks so much for this! I'm watching releases on this repo and will integrate check our use case (from #3671 and #3663) as soon as this release is kicked out. 🚀

@mikehardy
Copy link

Okay - #3671 is fixed for me with 9.16.4 (nice!) but #3663 is definitely not - still hangs on android

mikehardy added a commit to invertase/react-native-firebase that referenced this pull request Aug 13, 2021
mikehardy added a commit to invertase/react-native-firebase that referenced this pull request Aug 13, 2021
devpeerapong pushed a commit to devpeerapong/firebase-tools that referenced this pull request Dec 14, 2021
* Fix auth_time in Auth Emulator.

* Update CHANGELOG.md
@bkendall bkendall deleted the ys/fix-auth-time branch March 18, 2022 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Manual indication that this has passed CLA.
Projects
None yet
3 participants