From 6f39aa2b694c1212421bae83d8780fd49572d567 Mon Sep 17 00:00:00 2001 From: MichaelVerdon Date: Thu, 26 Feb 2026 14:46:29 +0000 Subject: [PATCH 1/8] feat: Provider guidance error in React example app --- examples/react/src/routes.ts | 8 + .../sign-in-auth-screen-provider-guidance.tsx | 234 ++++++++++++++++++ 2 files changed, 242 insertions(+) create mode 100644 examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx diff --git a/examples/react/src/routes.ts b/examples/react/src/routes.ts index f46f7290..26f0cf24 100644 --- a/examples/react/src/routes.ts +++ b/examples/react/src/routes.ts @@ -1,6 +1,7 @@ import SignInAuthScreenPage from "./screens/sign-in-auth-screen"; import SignInAuthScreenWithHandlersPage from "./screens/sign-in-auth-screen-w-handlers"; import SignInAuthScreenWithOAuthPage from "./screens/sign-in-auth-screen-w-oauth"; +import SignInAuthScreenProviderGuidancePage from "./screens/sign-in-auth-screen-provider-guidance"; import SignUpAuthScreenPage from "./screens/sign-up-auth-screen"; import SignUpAuthScreenWithHandlersPage from "./screens/sign-up-auth-screen-w-handlers"; import SignUpAuthScreenWithOAuthPage from "./screens/sign-up-auth-screen-w-oauth"; @@ -32,6 +33,13 @@ export const routes = [ path: "/screens/sign-in-auth-screen-w-oauth", component: SignInAuthScreenWithOAuthPage, }, + { + name: "Sign In Screen (provider guidance)", + description: + "Sign-in with OAuth; shows a custom message when email/password is used for an OAuth-only account. Requires email enumeration protection disabled.", + path: "/screens/sign-in-auth-screen-provider-guidance", + component: SignInAuthScreenProviderGuidancePage, + }, { name: "Sign Up Screen", description: "A sign up screen with email and password.", diff --git a/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx b/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx new file mode 100644 index 00000000..d7cb6cf6 --- /dev/null +++ b/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx @@ -0,0 +1,234 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { useState } from "react"; +import { + AppleSignInButton, + Card, + CardContent, + CardHeader, + CardSubtitle, + CardTitle, + Divider, + GoogleSignInButton, + FacebookSignInButton, + GitHubSignInButton, + MicrosoftSignInButton, + TwitterSignInButton, + YahooSignInButton, + useUI, + RedirectError, +} from "@firebase-oss/ui-react"; +import { + signInWithEmailAndPassword, + getTranslation, + FirebaseUIError, +} from "@firebase-oss/ui-core"; +import { + EmailAuthProvider, + fetchSignInMethodsForEmail, +} from "firebase/auth"; +import { useNavigate } from "react-router"; + +const PROVIDER_MISMATCH_MESSAGE = + "This account may have been created using a different sign-in method. Try signing in with another method or reset your password."; + +const PROVIDER_GUIDANCE_DOCS_URL = + "https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection"; + +export default function SignInAuthScreenProviderGuidancePage() { + const navigate = useNavigate(); + const ui = useUI(); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const [error, setError] = useState(null); + const [submitting, setSubmitting] = useState(false); + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + setError(null); + setSubmitting(true); + try { + await signInWithEmailAndPassword(ui, email, password); + navigate("/"); + } catch (err) { + if (err instanceof FirebaseUIError) { + // Set to true to display the raw error code instead of handling it (so you can see what to catch) + const DEBUG_SHOW_ERROR_CODE = false; + if (DEBUG_SHOW_ERROR_CODE) { + setError(`Error code: ${err.code}`); + setSubmitting(false); + return; + } + + const isInvalidCredentials = + err.code === "auth/wrong-password"; + + if (isInvalidCredentials) { + let signInMethods: string[] | undefined; + try { + signInMethods = await fetchSignInMethodsForEmail(ui.auth, email); + } catch { + // Fall through to Firebase message if fetch fails + } + + const accountExistsWithoutEmailPassword = + Array.isArray(signInMethods) && + signInMethods.length > 0 && + !signInMethods.includes(EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD); + + if (accountExistsWithoutEmailPassword) { + setError(PROVIDER_MISMATCH_MESSAGE); + setSubmitting(false); + return; + } + } + setError(err.message); + } else { + setError(getTranslation(ui, "errors", "unknownError")); + } + } finally { + setSubmitting(false); + } + }; + + const signInLabel = getTranslation(ui, "labels", "signIn"); + const signInSubtitle = getTranslation(ui, "prompts", "signInToAccount"); + const emailLabel = getTranslation(ui, "labels", "emailAddress"); + const passwordLabel = getTranslation(ui, "labels", "password"); + const dividerLabel = getTranslation(ui, "messages", "dividerOr"); + + return ( +
+
+

"Different sign-in method" message

+

+ This screen implements the flow manually: on email/password sign-in error we call{" "} + + fetchSignInMethodsForEmail + {" "} + and, if the account has no password method, show: +

+
+ "This account may have been created using a different sign-in method. Try signing in + with another method or reset your password." +
+

+ This only works when email enumeration protection is disabled. +

+

How to enable:

+
    +
  1. + Open{" "} + + Google Cloud Console + {" "} + and select your project. +
  2. +
  3. + Go to Identity PlatformSettings. +
  4. +
  5. + Find Email enumeration protection and turn it off. +
  6. +
+ + Docs: Enable or disable email enumeration protection + +

+ Trade-off: with it disabled, the API can reveal whether an email is registered. +

+
+ +
+ + + {signInLabel} + {signInSubtitle} + + +
+
+ + setEmail(e.target.value)} + required + autoComplete="email" + /> +
+
+ + setPassword(e.target.value)} + required + autoComplete="current-password" + /> +
+ {error ? ( +
+ {error} +
+ ) : null} +
+ +
+
+ + {dividerLabel} +
+ + + + + + + + +
+
+
+
+
+ ); +} From 70f3241f3b1f13971a336752f5d20b38bd5b4143 Mon Sep 17 00:00:00 2001 From: MichaelVerdon Date: Thu, 26 Feb 2026 14:52:21 +0000 Subject: [PATCH 2/8] format: run format --- .../sign-in-auth-screen-provider-guidance.tsx | 38 +++++-------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx b/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx index d7cb6cf6..d573b816 100644 --- a/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx +++ b/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx @@ -32,22 +32,14 @@ import { useUI, RedirectError, } from "@firebase-oss/ui-react"; -import { - signInWithEmailAndPassword, - getTranslation, - FirebaseUIError, -} from "@firebase-oss/ui-core"; -import { - EmailAuthProvider, - fetchSignInMethodsForEmail, -} from "firebase/auth"; +import { signInWithEmailAndPassword, getTranslation, FirebaseUIError } from "@firebase-oss/ui-core"; +import { EmailAuthProvider, fetchSignInMethodsForEmail } from "firebase/auth"; import { useNavigate } from "react-router"; const PROVIDER_MISMATCH_MESSAGE = "This account may have been created using a different sign-in method. Try signing in with another method or reset your password."; -const PROVIDER_GUIDANCE_DOCS_URL = - "https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection"; +const PROVIDER_GUIDANCE_DOCS_URL = "https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection"; export default function SignInAuthScreenProviderGuidancePage() { const navigate = useNavigate(); @@ -74,8 +66,7 @@ export default function SignInAuthScreenProviderGuidancePage() { return; } - const isInvalidCredentials = - err.code === "auth/wrong-password"; + const isInvalidCredentials = err.code === "auth/wrong-password"; if (isInvalidCredentials) { let signInMethods: string[] | undefined; @@ -117,14 +108,12 @@ export default function SignInAuthScreenProviderGuidancePage() {

"Different sign-in method" message

This screen implements the flow manually: on email/password sign-in error we call{" "} - - fetchSignInMethodsForEmail - {" "} + fetchSignInMethodsForEmail{" "} and, if the account has no password method, show:

- "This account may have been created using a different sign-in method. Try signing in - with another method or reset your password." + "This account may have been created using a different sign-in method. Try signing in with another method + or reset your password."

This only works when email enumeration protection is disabled. @@ -133,12 +122,7 @@ export default function SignInAuthScreenProviderGuidancePage() {

  1. Open{" "} - + Google Cloud Console {" "} and select your project. @@ -205,11 +189,7 @@ export default function SignInAuthScreenProviderGuidancePage() { ) : null}
    -
    From 2d37615842a8a22be07a411852d789237ebb27d1 Mon Sep 17 00:00:00 2001 From: MichaelVerdon Date: Fri, 27 Feb 2026 15:14:16 +0000 Subject: [PATCH 3/8] feat: change to database approach --- examples/react/src/routes.ts | 8 + .../sign-in-auth-screen-provider-guidance.tsx | 152 +++++++----------- 2 files changed, 68 insertions(+), 92 deletions(-) diff --git a/examples/react/src/routes.ts b/examples/react/src/routes.ts index 26f0cf24..e9d2c830 100644 --- a/examples/react/src/routes.ts +++ b/examples/react/src/routes.ts @@ -13,6 +13,7 @@ import CustomAuthScreenPage from "./screens/custom-auth-screen"; import PhoneAuthScreenPage from "./screens/phone-auth-screen"; import PhoneAuthScreenWithOAuthPage from "./screens/phone-auth-screen-w-oauth"; import MultiFactorAuthEnrollmentScreenPage from "./screens/mfa-enrollment-screen"; +import SignUpAuthScreenProviderGuidancePage from "./screens/sign-up-auth-screen-provider-guidance"; export const routes = [ { @@ -40,6 +41,13 @@ export const routes = [ path: "/screens/sign-in-auth-screen-provider-guidance", component: SignInAuthScreenProviderGuidancePage, }, + { + name: "Sign Up Screen (provider guidance)", + description: + "Sign up with provider then log to database for provider guidance error messaging", + path: "/screens/sign-up-auth-screen-provider-guidance", + component: SignUpAuthScreenProviderGuidancePage, + }, { name: "Sign Up Screen", description: "A sign up screen with email and password.", diff --git a/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx b/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx index d573b816..b1c19ae3 100644 --- a/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx +++ b/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx @@ -2,16 +2,6 @@ * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ import { useState } from "react"; @@ -32,18 +22,24 @@ import { useUI, RedirectError, } from "@firebase-oss/ui-react"; -import { signInWithEmailAndPassword, getTranslation, FirebaseUIError } from "@firebase-oss/ui-core"; -import { EmailAuthProvider, fetchSignInMethodsForEmail } from "firebase/auth"; + +import { + signInWithEmailAndPassword, + getTranslation, + FirebaseUIError, +} from "@firebase-oss/ui-core"; + +import { getDatabase, ref, get } from "firebase/database"; import { useNavigate } from "react-router"; const PROVIDER_MISMATCH_MESSAGE = "This account may have been created using a different sign-in method. Try signing in with another method or reset your password."; -const PROVIDER_GUIDANCE_DOCS_URL = "https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection"; - export default function SignInAuthScreenProviderGuidancePage() { const navigate = useNavigate(); const ui = useUI(); + const db = getDatabase(); + const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(null); @@ -53,44 +49,44 @@ export default function SignInAuthScreenProviderGuidancePage() { e.preventDefault(); setError(null); setSubmitting(true); + try { + // Attempt login first await signInWithEmailAndPassword(ui, email, password); - navigate("/"); - } catch (err) { + navigate("/"); // success + + } catch (err: any) { + console.log("Sign-in error:", err); + if (err instanceof FirebaseUIError) { - // Set to true to display the raw error code instead of handling it (so you can see what to catch) - const DEBUG_SHOW_ERROR_CODE = false; - if (DEBUG_SHOW_ERROR_CODE) { - setError(`Error code: ${err.code}`); - setSubmitting(false); - return; - } - - const isInvalidCredentials = err.code === "auth/wrong-password"; - - if (isInvalidCredentials) { - let signInMethods: string[] | undefined; + // Only show provider guidance if password is wrong + if (err.code === "auth/wrong-password") { try { - signInMethods = await fetchSignInMethodsForEmail(ui.auth, email); - } catch { - // Fall through to Firebase message if fetch fails - } - - const accountExistsWithoutEmailPassword = - Array.isArray(signInMethods) && - signInMethods.length > 0 && - !signInMethods.includes(EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD); - - if (accountExistsWithoutEmailPassword) { - setError(PROVIDER_MISMATCH_MESSAGE); - setSubmitting(false); - return; + // Normalize email for DB lookup + const safeEmail = email.trim().toLowerCase().replace(/\./g, ","); + const snapshot = await get(ref(db, `usersByEmail/${safeEmail}`)); + + if (snapshot.exists()) { + const provider = snapshot.val().provider; + if (provider !== "password") { + setError(PROVIDER_MISMATCH_MESSAGE); + return; // stop here + } + } + } catch (dbErr) { + console.log("RTDB read error:", dbErr); } } + + // If not wrong-password or no provider guidance, show original error setError(err.message); + + } else if (err?.code || err?.message) { + setError(err.message || err.code); } else { - setError(getTranslation(ui, "errors", "unknownError")); + setError("Unexpected error occurred."); } + } finally { setSubmitting(false); } @@ -104,59 +100,20 @@ export default function SignInAuthScreenProviderGuidancePage() { return (
    -
    -

    "Different sign-in method" message

    -

    - This screen implements the flow manually: on email/password sign-in error we call{" "} - fetchSignInMethodsForEmail{" "} - and, if the account has no password method, show: -

    -
    - "This account may have been created using a different sign-in method. Try signing in with another method - or reset your password." -
    -

    - This only works when email enumeration protection is disabled. -

    -

    How to enable:

    -
      -
    1. - Open{" "} - - Google Cloud Console - {" "} - and select your project. -
    2. -
    3. - Go to Identity PlatformSettings. -
    4. -
    5. - Find Email enumeration protection and turn it off. -
    6. -
    - - Docs: Enable or disable email enumeration protection - -

    - Trade-off: with it disabled, the API can reveal whether an email is registered. -

    -
    -
    {signInLabel} {signInSubtitle} +
    -
    +
    -
    - {error ? ( + + {error && (
    {error}
    - ) : null} + )} +
    -
    {dividerLabel} +
    @@ -211,4 +179,4 @@ export default function SignInAuthScreenProviderGuidancePage() {
    ); -} +} \ No newline at end of file From c1ffdaa13abd0d1e399fee34f4eaa72d4fd65a96 Mon Sep 17 00:00:00 2001 From: MichaelVerdon Date: Fri, 27 Feb 2026 15:14:45 +0000 Subject: [PATCH 4/8] feat: add sign up screen to log to db --- .../sign-up-auth-screen-provider-guidance.tsx | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 examples/react/src/screens/sign-up-auth-screen-provider-guidance.tsx diff --git a/examples/react/src/screens/sign-up-auth-screen-provider-guidance.tsx b/examples/react/src/screens/sign-up-auth-screen-provider-guidance.tsx new file mode 100644 index 00000000..430e9417 --- /dev/null +++ b/examples/react/src/screens/sign-up-auth-screen-provider-guidance.tsx @@ -0,0 +1,43 @@ +import { useNavigate } from "react-router"; +import { useUI } from "@firebase-oss/ui-react"; +import { + SignUpAuthScreen, + GoogleSignInButton, + FacebookSignInButton, + AppleSignInButton, + GitHubSignInButton, + MicrosoftSignInButton, + TwitterSignInButton, + YahooSignInButton, +} from "@firebase-oss/ui-react"; + +import { getDatabase, ref, set } from "firebase/database"; + +export default function SignUpAuthScreenProviderGuidancePage() { + const navigate = useNavigate(); + const ui = useUI(); + const db = getDatabase(); + + return ( + { + if (!user?.email) return; + const safeEmail = user.email.replace(/\./g, ","); + await set(ref(db, `usersByEmail/${safeEmail}`), { + provider: user.providerData[0]?.providerId, + email: user.email, + uid: user.uid, + }); + navigate("/"); + }} + > + + + + + + + + + ); +} From 2b0a21f9b640e6239665065693173c933b6784df Mon Sep 17 00:00:00 2001 From: MichaelVerdon Date: Fri, 27 Feb 2026 15:24:38 +0000 Subject: [PATCH 5/8] format: run format --- .../sign-in-auth-screen-provider-guidance.tsx | 35 +++++-------------- .../sign-up-auth-screen-provider-guidance.tsx | 1 - 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx b/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx index b1c19ae3..513fccd4 100644 --- a/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx +++ b/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx @@ -23,11 +23,7 @@ import { RedirectError, } from "@firebase-oss/ui-react"; -import { - signInWithEmailAndPassword, - getTranslation, - FirebaseUIError, -} from "@firebase-oss/ui-core"; +import { signInWithEmailAndPassword, getTranslation, FirebaseUIError } from "@firebase-oss/ui-core"; import { getDatabase, ref, get } from "firebase/database"; import { useNavigate } from "react-router"; @@ -49,15 +45,14 @@ export default function SignInAuthScreenProviderGuidancePage() { e.preventDefault(); setError(null); setSubmitting(true); - + try { // Attempt login first await signInWithEmailAndPassword(ui, email, password); navigate("/"); // success - } catch (err: any) { console.log("Sign-in error:", err); - + if (err instanceof FirebaseUIError) { // Only show provider guidance if password is wrong if (err.code === "auth/wrong-password") { @@ -65,7 +60,7 @@ export default function SignInAuthScreenProviderGuidancePage() { // Normalize email for DB lookup const safeEmail = email.trim().toLowerCase().replace(/\./g, ","); const snapshot = await get(ref(db, `usersByEmail/${safeEmail}`)); - + if (snapshot.exists()) { const provider = snapshot.val().provider; if (provider !== "password") { @@ -77,16 +72,14 @@ export default function SignInAuthScreenProviderGuidancePage() { console.log("RTDB read error:", dbErr); } } - + // If not wrong-password or no provider guidance, show original error setError(err.message); - } else if (err?.code || err?.message) { setError(err.message || err.code); } else { setError("Unexpected error occurred."); } - } finally { setSubmitting(false); } @@ -110,10 +103,7 @@ export default function SignInAuthScreenProviderGuidancePage() {
    -
    ); -} \ No newline at end of file +} diff --git a/examples/react/src/screens/sign-up-auth-screen-provider-guidance.tsx b/examples/react/src/screens/sign-up-auth-screen-provider-guidance.tsx index 430e9417..a116f7c5 100644 --- a/examples/react/src/screens/sign-up-auth-screen-provider-guidance.tsx +++ b/examples/react/src/screens/sign-up-auth-screen-provider-guidance.tsx @@ -15,7 +15,6 @@ import { getDatabase, ref, set } from "firebase/database"; export default function SignUpAuthScreenProviderGuidancePage() { const navigate = useNavigate(); - const ui = useUI(); const db = getDatabase(); return ( From 02c4b9788cfc16737905e00d9c4311677853f73f Mon Sep 17 00:00:00 2001 From: MichaelVerdon Date: Fri, 27 Feb 2026 15:42:06 +0000 Subject: [PATCH 6/8] chore: remove logs and add doc --- .../sign-in-auth-screen-provider-guidance.tsx | 5 ++--- .../sign-up-auth-screen-provider-guidance.tsx | 12 +++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx b/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx index 513fccd4..72356552 100644 --- a/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx +++ b/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx @@ -51,10 +51,9 @@ export default function SignInAuthScreenProviderGuidancePage() { await signInWithEmailAndPassword(ui, email, password); navigate("/"); // success } catch (err: any) { - console.log("Sign-in error:", err); - if (err instanceof FirebaseUIError) { // Only show provider guidance if password is wrong + // This is the error you will need to catch and handle in your app if (err.code === "auth/wrong-password") { try { // Normalize email for DB lookup @@ -69,7 +68,7 @@ export default function SignInAuthScreenProviderGuidancePage() { } } } catch (dbErr) { - console.log("RTDB read error:", dbErr); + setError("Error getting user by email: " + String(dbErr)); } } diff --git a/examples/react/src/screens/sign-up-auth-screen-provider-guidance.tsx b/examples/react/src/screens/sign-up-auth-screen-provider-guidance.tsx index a116f7c5..ac213a4d 100644 --- a/examples/react/src/screens/sign-up-auth-screen-provider-guidance.tsx +++ b/examples/react/src/screens/sign-up-auth-screen-provider-guidance.tsx @@ -1,5 +1,4 @@ import { useNavigate } from "react-router"; -import { useUI } from "@firebase-oss/ui-react"; import { SignUpAuthScreen, GoogleSignInButton, @@ -27,6 +26,17 @@ export default function SignUpAuthScreenProviderGuidancePage() { email: user.email, uid: user.uid, }); + // RTDB rules for usersByEmail + // { + // "rules": { + // "usersByEmail": { + // "$email": { + // ".read": true, // anyone can check provider + // ".write": "auth != null" // only logged-in users can write + // } + // } + // } + // } navigate("/"); }} > From 0845ca3b42b513cd8721abc95aa8254077353870 Mon Sep 17 00:00:00 2001 From: MichaelVerdon Date: Fri, 27 Feb 2026 15:45:41 +0000 Subject: [PATCH 7/8] chore: format --- examples/react/src/routes.ts | 3 +-- .../src/screens/sign-in-auth-screen-provider-guidance.tsx | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/react/src/routes.ts b/examples/react/src/routes.ts index e9d2c830..7d296ee5 100644 --- a/examples/react/src/routes.ts +++ b/examples/react/src/routes.ts @@ -43,8 +43,7 @@ export const routes = [ }, { name: "Sign Up Screen (provider guidance)", - description: - "Sign up with provider then log to database for provider guidance error messaging", + description: "Sign up with provider then log to database for provider guidance error messaging", path: "/screens/sign-up-auth-screen-provider-guidance", component: SignUpAuthScreenProviderGuidancePage, }, diff --git a/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx b/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx index 72356552..664d99a3 100644 --- a/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx +++ b/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx @@ -50,7 +50,7 @@ export default function SignInAuthScreenProviderGuidancePage() { // Attempt login first await signInWithEmailAndPassword(ui, email, password); navigate("/"); // success - } catch (err: any) { + } catch (err) { if (err instanceof FirebaseUIError) { // Only show provider guidance if password is wrong // This is the error you will need to catch and handle in your app From 8363aad5958eeb182f3fd31454eb513215b58a82 Mon Sep 17 00:00:00 2001 From: MichaelVerdon Date: Fri, 27 Feb 2026 15:50:42 +0000 Subject: [PATCH 8/8] fix: type errors --- .../screens/sign-in-auth-screen-provider-guidance.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx b/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx index 664d99a3..a6d162a9 100644 --- a/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx +++ b/examples/react/src/screens/sign-in-auth-screen-provider-guidance.tsx @@ -73,13 +73,12 @@ export default function SignInAuthScreenProviderGuidancePage() { } // If not wrong-password or no provider guidance, show original error - setError(err.message); - } else if (err?.code || err?.message) { - setError(err.message || err.code); - } else { - setError("Unexpected error occurred."); + setError( + err && typeof err === "object" && typeof (err as { message?: unknown }).message === "string" + ? (err as { message: string }).message + : "An unknown error occurred." + ); } - } finally { setSubmitting(false); } };