'Firebase SMS multifactor authentication, error.resolver is undefined

I'm following a seemingly outdated documentation page at https://cloud.google.com/identity-platform/docs/web/mfa#choosing_an_enrollment_pattern When signing in with email + password, I'm expecting to catch error, and then do

if (error.code === "auth/multi-factor-auth-required") {
            const resolver = error.resolver

But when I logged out the error object, there is no such property as error.resolver:

FirebaseError: Firebase: Error (auth/multi-factor-auth-required). resolver:  undefined


Solution 1:[1]

I had the same issue and found this little gem in the docs for the most recent version of Firebase for JavaScript (version 9 at the time of this post). Most of the MFA docs seem to be referencing the way it was done for version 8.

resolver = getMultiFactorResolver(auth, error);

You will need to import getMultiFactorResolver from Firebase auth.

Source

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mass Dot Net