Skip to content

Commit

Permalink
Update phone auth snippets with RecaptchaVerifier parameter reordering (
Browse files Browse the repository at this point in the history
#348)

* Update phone auth snippets with RecaptchaVerifier parameter reordering

* Update auth-next dependency to v10
  • Loading branch information
ch5zzy authored Jul 10, 2023
1 parent 7156e6c commit 9931033
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion auth-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
},
"license": "Apache-2.0",
"dependencies": {
"firebase": "^9.22.2"
"firebase": "^10.0.0"
}
}
10 changes: 5 additions & 5 deletions auth-next/phone-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ function recaptchaVerifierInvisible() {
const { getAuth, RecaptchaVerifier } = require("firebase/auth");

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

Expand All @@ -30,7 +30,7 @@ function recaptchaVerifierVisible() {
const { getAuth, RecaptchaVerifier } = require("firebase/auth");

const auth = getAuth();
window.recaptchaVerifier = new RecaptchaVerifier('recaptcha-container', {
window.recaptchaVerifier = new RecaptchaVerifier(auth, 'recaptcha-container', {
'size': 'normal',
'callback': (response) => {
// reCAPTCHA solved, allow signInWithPhoneNumber.
Expand All @@ -40,7 +40,7 @@ function recaptchaVerifierVisible() {
// Response expired. Ask user to solve reCAPTCHA again.
// ...
}
}, auth);
});
// [END auth_phone_recaptcha_verifier_visible]
}

Expand All @@ -49,7 +49,7 @@ function recaptchaVerifierSimple() {
const { getAuth, RecaptchaVerifier } = require("firebase/auth");

const auth = getAuth();
window.recaptchaVerifier = new RecaptchaVerifier('recaptcha-container', {}, auth);
window.recaptchaVerifier = new RecaptchaVerifier(auth, 'recaptcha-container', {});
// [END auth_phone_recaptcha_verifier_simple]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import { getAuth, RecaptchaVerifier } from "firebase/auth";

const auth = getAuth();
window.recaptchaVerifier = new RecaptchaVerifier('sign-in-button', {
window.recaptchaVerifier = new RecaptchaVerifier(auth, 'sign-in-button', {
'size': 'invisible',
'callback': (response) => {
// reCAPTCHA solved, allow signInWithPhoneNumber.
onSignInSubmit();
}
}, auth);
});
// [END auth_phone_recaptcha_verifier_invisible_modular]
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
import { getAuth, RecaptchaVerifier } from "firebase/auth";

const auth = getAuth();
window.recaptchaVerifier = new RecaptchaVerifier('recaptcha-container', {}, auth);
window.recaptchaVerifier = new RecaptchaVerifier(auth, 'recaptcha-container', {});
// [END auth_phone_recaptcha_verifier_simple_modular]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { getAuth, RecaptchaVerifier } from "firebase/auth";

const auth = getAuth();
window.recaptchaVerifier = new RecaptchaVerifier('recaptcha-container', {
window.recaptchaVerifier = new RecaptchaVerifier(auth, 'recaptcha-container', {
'size': 'normal',
'callback': (response) => {
// reCAPTCHA solved, allow signInWithPhoneNumber.
Expand All @@ -18,5 +18,5 @@ window.recaptchaVerifier = new RecaptchaVerifier('recaptcha-container', {
// Response expired. Ask user to solve reCAPTCHA again.
// ...
}
}, auth);
});
// [END auth_phone_recaptcha_verifier_visible_modular]

0 comments on commit 9931033

Please sign in to comment.