Skip to content

Commit b832062

Browse files
Merge master into release
2 parents 207ef71 + 1261d83 commit b832062

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.changeset/smooth-readers-cough.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/auth': patch
3+
---
4+
5+
Fix a bug causing ReCAPTCHA conflicts between Auth and App Check.

packages/auth/src/platform_browser/recaptcha/recaptcha_loader.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ export interface ReCaptchaLoader {
4949
export class ReCaptchaLoaderImpl implements ReCaptchaLoader {
5050
private hostLanguage = '';
5151
private counter = 0;
52-
private readonly librarySeparatelyLoaded = !!_window().grecaptcha;
52+
/**
53+
* Check for `render()` method. `window.grecaptcha` will exist if the Enterprise
54+
* version of the ReCAPTCHA script was loaded by someone else (e.g. App Check) but
55+
* `window.grecaptcha.render()` will not. Another load will add it.
56+
*/
57+
private readonly librarySeparatelyLoaded = !!_window().grecaptcha?.render;
5358

5459
load(auth: AuthInternal, hl = ''): Promise<Recaptcha> {
5560
_assert(isHostLanguageValid(hl), auth, AuthErrorCode.ARGUMENT_ERROR);
@@ -112,7 +117,7 @@ export class ReCaptchaLoaderImpl implements ReCaptchaLoader {
112117
// In cases (2) and (3), we _can't_ reload as it would break the recaptchas
113118
// that are already in the page
114119
return (
115-
!!_window().grecaptcha &&
120+
!!_window().grecaptcha?.render &&
116121
(hl === this.hostLanguage ||
117122
this.counter > 0 ||
118123
this.librarySeparatelyLoaded)

0 commit comments

Comments
 (0)