-
Notifications
You must be signed in to change notification settings - Fork 975
Cleanup TOTP code to include Firebase User reference in MultiFactorSession. #7346
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
Conversation
|
Size Report 1Affected Products
Test Logs |
Size Analysis Report 1Affected Products
Test Logs |
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.
Thanks for fixing this!
) {} | ||
|
||
static _fromIdtoken( | ||
idToken: string, | ||
auth?: AuthInternal | ||
user?: UserInternal |
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.
I wonder if we can make "user" a required parameter here. The only place this is invoked without the "user" is the fromJSON method -
return MultiFactorSessionImpl._fromIdtoken( |
But I don't see this method being used anywhere. @sam-gc do you know why we have these methods?
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.
I wonder if we can make "user" a required parameter here. The only place this is invoked without the "user" is the fromJSON method -
return MultiFactorSessionImpl._fromIdtoken( But I don't see this method being used anywhere. Sam do you know why we have these methods?
toJSON can be invoked when an end user calls JSON.stringify(), but it's unclear where fromJSON is used.. since JSON.parse won't automatically call it and it is not in the expected reviver format - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#using_the_reviver_parameter
But i think it is ok to leave it be, in case users are manually calling this function somewhere.
packages/auth/src/platform_browser/mfa/assertions/phone.test.ts
Outdated
Show resolved
Hide resolved
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.
Please update the PR description to include any manual testing results with the demo app.
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.
Thanks, looks good to me. Please update the PR description to provide a bit more details.
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.
LGTM, except for the one comment about user param in _fromIdToken.
Let's also verify this in the demo app to make sure it works end to end. Thanks!
…ssion. (#7346) * cleanup TOTP code to include Firebase user reference in MultiFactorSession * removed helper comments * Added fakeUid const to organize code * edited test to match changes in MultiFactorSession * resolved TestAuth incompatible type error * resolved more TestAuth incompatible type error * resubmitting * fixed formatting & resolved issue with undefined * fixed format issue * fixed formatting * tried to resolve issue with user being undefined * fixed if statement formatting * addressed feedback: changed expect to compare user * fixed formatting * fixed the issue with undefined * instantiate user * organized import statements * changed import formatting * resubmitting for import formatting issue * ran yarn format
Cleanup TOTP code to include Firebase User reference in MultiFactorSession.
Ran the code in demo app and was able to complete TOTP enrollment.