Firebase Phone Auth Vuex

Viewed 24

I am trying to implement Firebase phone auth using vuex. https://firebase.google.com/docs/auth/web/phone-auth

I have successfully implemented email & password sign in and now wish to convert the process to phone auth.

I am using Vue3, composition API. The code I need to implement is from the firebase link above being:

import { getAuth, RecaptchaVerifier } from "firebase/auth";
const auth = getAuth();
window.recaptchaVerifier = new RecaptchaVerifier('sign-in-button', {
  'size': 'invisible',
  'callback': (response) => {
    // reCAPTCHA solved, allow signInWithPhoneNumber.
    onSignInSubmit();
  }
}, auth);

I am not sure how to implement this using the composition API.

Should recaptchaVerifier be defined as a variable, a ref or a computed property in the setup function?

0 Answers
Related