'Getting error while verifying phone number in firebase (angular project)
I am working on an angular project, where I am adding MultiFactor Authorisation using firebase authentication, I am trying to verify phone number by firebase.auth.PhoneAuthProvider.verifyPhoneNumber function, it should take , phoneInfoOptions and capthaverfier as an argument but I am getting below error ,
error:
u {code: "auth/argument-error", message: "verifyPhoneNumber failed: First argument "phoneInf…st be a valid string or valid phone info options.", a: null}
My code:
var phoneInfoOptions = {
Hint: this.windowRef.resolver.hints[0],
session: this.windowRef.resolver.session,
};
this.windowRef.verificationId = await phoneAuthProvider.verifyPhoneNumber(
phoneInfoOptions,
appVerifier
);
Solution 1:[1]
is there a typo in the phoneInfoOptions field name? from https://firebase.google.com/docs/reference/js/firebase.auth.multifactorresolver
var phoneInfoOptions = {
multiFactorHint: selectedHint,
session: resolver.session
};
Solution 2:[2]
Try converting phone number to string and then pass it.
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 | chronologos |
Solution 2 | user12428264 |