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

feat(auth): include phoneNumber from PhoneMultiFactorInfo #7565

Merged
merged 5 commits into from
May 20, 2024

Conversation

mnahkies
Copy link
Contributor

@mnahkies mnahkies commented Jan 14, 2024

Description

Expose phoneNumber on the MFA hints to JS.

MultiFactorInfo has two sub-classes in the underlying SDK's - one for TOTP and one for Phone, where the Phone one additionally includes the phoneNumber registered to the factor.

Before login the phoneNumber is redacted, and after login it is unredacted.

This is useful for showing the user a hint as to which phone number they should check, or distinguishing between multiple phone factors.

Additionally rename enrollmentDate -> enrollmentTime on iOS to match Android/Web (ref: https://firebase.google.com/docs/reference/js/auth.multifactorinfo)

  • If we'd rather avoid the breaking change here, perhaps we could keep enrollmentDate as deprecated on iOS?

ref:

Release Summary

  • Expose phoneNumber on PhoneMultiFactorInfo
  • Rename enrollmentDate to enrollmentTime on iOS to match Android/Web

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • [] No

Test Plan

Tested on Android emulator, observed:

  • Redacted phoneNumber included in hint on the login challenge
  • Unredacted phoneNumber included in hint after login (eg: showing a manage mfa UI)

NOT tested on iOS - ideally could do with some help here.


🔥

Copy link

vercel bot commented Jan 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-firebase ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 20, 2024 1:59am
react-native-firebase-next ❌ Failed (Inspect) May 20, 2024 1:59am

@CLAassistant
Copy link

CLAassistant commented Jan 14, 2024

CLA assistant check
All committers have signed the CLA.

@mnahkies
Copy link
Contributor Author

Vercel – react-native-firebase-next — Deployment has failed

I don't seem to be able to access the logs for this 😞

Copy link
Collaborator

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

This looks pretty good - I left a few comments in form of code suggestions which could be adopted and this could merge, or if you've got thoughts + counter-proposals I'm happy to hear them

in general though I like the idea of backwards-compatibility to avoid the break, and following the same null-check idiom in the iOS code

packages/auth/ios/RNFBAuth/RNFBAuthModule.m Outdated Show resolved Hide resolved
packages/auth/ios/RNFBAuth/RNFBAuthModule.m Outdated Show resolved Hide resolved
packages/auth/lib/index.d.ts Show resolved Hide resolved
@mikehardy mikehardy added Workflow: Waiting for User Response Blocked waiting for user response. plugin: authentication Firebase Authentication labels Jan 23, 2024
@mikehardy mikehardy changed the title feat!: include phoneNumber from PhoneMultiFactorInfo / enrollmentDate -> enrollmentTime feat(auth): include phoneNumber from PhoneMultiFactorInfo Jan 23, 2024
Copy link

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Feb 21, 2024
@mikehardy
Copy link
Collaborator

Still very interested in getting this one in - just had a couple more things that were high priority slice into my queue in front of it - apologies

@github-actions github-actions bot removed the Stale label Feb 21, 2024
mnahkies added a commit to mnahkies/react-native-firebase that referenced this pull request Mar 9, 2024
Copy link

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Mar 25, 2024
@github-actions github-actions bot closed this Apr 9, 2024
@mikehardy mikehardy reopened this Apr 11, 2024
Copy link

codecov bot commented Apr 11, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 33.36%. Comparing base (a2e3206) to head (3e397a4).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7565      +/-   ##
==========================================
+ Coverage   32.97%   33.36%   +0.39%     
==========================================
  Files         252      252              
  Lines       12530    12533       +3     
  Branches     1954     1956       +2     
==========================================
+ Hits         4131     4180      +49     
+ Misses       8305     8264      -41     
+ Partials       94       89       -5     

Copy link
Collaborator

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

I think if you add the nil check on phone number, allow it to return null in the JS-level typing, and remove the enrollmentTime/Date change (which I just merged separately) this can go in? I think that would satisfy all the comments here

Again, thanks for the patience, we're moving a bit now...

@mnahkies mnahkies force-pushed the mn/feat/marshall-phone-number branch from 326e070 to 993c696 Compare April 20, 2024 10:26
@mikehardy
Copy link
Collaborator

Oh of course the patch set generation fails this time because of some new CI features 🤦 - need to fix that, then rebase and re-run it, will be a bit, sorry

@mikehardy
Copy link
Collaborator

@yuvalhermelin-fijoya okay, fixed the patchset generation it will show up as an attachment here: https://github.com/invertase/react-native-firebase/actions/runs/9086347168?pr=7565

The auth one is the only one you are interested in, but the patchset contains all merged changes since last public release + this PR, so all of them are valid.

I don't anticipate that any of the code here will change, the holdup now is test process

@mikehardy
Copy link
Collaborator

I just fixed a major chunk of our test process issues with #7797
One more major chunk to truly verify this change - but I will likely defer the most difficult part of that change in it to get this through

@mikehardy mikehardy force-pushed the mn/feat/marshall-phone-number branch from 8792280 to 34f4379 Compare May 20, 2024 00:14
@mikehardy mikehardy removed the Workflow: Waiting for User Response Blocked waiting for user response. label May 20, 2024
mikehardy
mikehardy previously approved these changes May 20, 2024
Copy link
Collaborator

@mikehardy mikehardy 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 looking good now - on course to land tonight and release, last bit of testing (enabling MFA tests for iOS) I'm going to defer as it implies a big shift to how we work since it's an auth-emulator vs cloud-auth thing

@mikehardy
Copy link
Collaborator

still need to merge the test tweak from #7565 (comment) then this can go

mnahkies and others added 5 commits May 19, 2024 20:55
this is useful for indicating to users which phone number they have
enrolled, and distinguishing between factors if there are multiple
phone factors enrolled.
behavior should mirror what android native MFA does with this change
@mikehardy mikehardy force-pushed the mn/feat/marshall-phone-number branch from 5d87679 to 3e397a4 Compare May 20, 2024 01:55
@mikehardy mikehardy merged commit 3d61e32 into invertase:main May 20, 2024
15 of 16 checks passed
@yuvalhermelin-fijoya
Copy link

Thanks guys!

@mikehardy mikehardy removed the Workflow: Pending Merge Waiting on CI or similar label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: authentication Firebase Authentication
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants