@@ -43,10 +43,19 @@ class FirebaseAppCheckWeb extends FirebaseAppCheckPlatform {
4343 ensurePluginInitialized: (firebaseApp) async {
4444 final instance =
4545 FirebaseAppCheckWeb (app: Firebase .app (firebaseApp.name));
46- final recaptchaType = web.window.sessionStorage
46+ var recaptchaType = web.window.localStorage
4747 .getItem (_sessionKeyRecaptchaType (firebaseApp.name));
48- final recaptchaSiteKey = web.window.sessionStorage
48+ var recaptchaSiteKey = web.window.localStorage
4949 .getItem (_sessionKeyRecaptchaSiteKey (firebaseApp.name));
50+
51+ // For backwards compatibility, with previously used session storage
52+ if (recaptchaType == null || recaptchaSiteKey == null ) {
53+ recaptchaType = web.window.sessionStorage
54+ .getItem (_sessionKeyRecaptchaType (firebaseApp.name));
55+ recaptchaSiteKey = web.window.sessionStorage
56+ .getItem (_sessionKeyRecaptchaSiteKey (firebaseApp.name));
57+ }
58+
5059 if (recaptchaType != null && recaptchaSiteKey != null ) {
5160 final WebProvider provider;
5261 if (recaptchaType == recaptchaTypeV3) {
@@ -125,9 +134,9 @@ class FirebaseAppCheckWeb extends FirebaseAppCheckPlatform {
125134 } else {
126135 throw Exception ('Invalid web provider: $webProvider ' );
127136 }
128- web.window.sessionStorage
137+ web.window.localStorage
129138 .setItem (_sessionKeyRecaptchaType (app.name), recaptchaType);
130- web.window.sessionStorage
139+ web.window.localStorage
131140 .setItem (_sessionKeyRecaptchaSiteKey (app.name), webProvider.siteKey);
132141 }
133142
0 commit comments