Search code examples
angulartypescriptfirebaseionic-frameworkcordova-plugins

Expected 3-4 arguments, but got 2.ts FirebaseX Ionic native plugin


I need to use Firebase Phone Auth with FirebaseX plugin. I have tried like so:

 async getVerificationCode(): void {

    const res:any = await this.firebaseX.verifyPhoneNumber('+16505553434', 60);

  }

But it says like this:

Expected 3-4 arguments, but got 2.ts(2554) index.d.ts(347, 96): An argument for 'phoneNumber' was not provided.

  "@ionic/angular": "5.1.1",
  "@ionic-native/firebase-x": "^5.26.0",
  "firebase": "7.15.0",

Any clue how to use this properly?

API:

>   verifyPhoneNumber(success: (value: string | object) => void, error:
> (err: string) => void, phoneNumber: string, timeoutDuration?: number):
> Promise<any>;
>     /**
>      * Signs the user into Firebase with credentials obtained using verifyPhoneNumber().
>      * See the Android- and iOS-specific Firebase documentation for more info.
>      * @param {object} credential - a credential object returned by the success callback of an authentication method
>      * @param {function} success - callback function to call on successful sign-in using credentials
>      * @param {function} error - callback function which will be passed a {string} error message as an argument
>      */

Solution

  • It's expecting two callbacks before your arguments. Try

    const res:any = await this.firebaseX.verifyPhoneNumber(() => {}, () => {}, '+16505553434', 60);