Search code examples
firebasefirebase-authenticationrecaptchacaptcha

is there possible using manual recaptcha verification API in firebase.auth().signInWithPhoneNumber?


I know firebase sdk have a built in function to verified recaptcha response before doing sign-in with phone number but, it is possible using manual captcha verifier API return response from https://www.google.com/recaptcha/api/siteverify as 2nd parameter in firebase.auth().signInWithPhoneNumber(phone, apiResponse) ?

I have different case to do it manually.

Thanks


Solution

  • With Recaptcha, you can introduce your own authorization method by using a decodable JWT as a second input. this will require a source of validation to generate the correct token

        const captchaVerifier = {
          type: 'recaptcha',
          verify: () => Promise.resolve(token)
        };
    

    Source: https://pastebin.com/kaCarKC5

    You could also make your own ReCaptcha that triggers the invisible ReCaptcha or simply use invisible ReCaptcha and implement your own later on per your app's design.

    Reference: Invisible ReCaptcha