diff --git a/packages/react/src/auth/oauth/oauth-button.test.tsx b/packages/react/src/auth/oauth/oauth-button.test.tsx
index faf06e2d..dbb558d3 100644
--- a/packages/react/src/auth/oauth/oauth-button.test.tsx
+++ b/packages/react/src/auth/oauth/oauth-button.test.tsx
@@ -429,7 +429,13 @@ describe("useSignInWithProvider", () => {
// First call fails, second call succeeds
mockSignInWithProvider
.mockRejectedValueOnce(
- new FirebaseUIError(ui.get(), new FirebaseError("auth/wrong-password", "Incorrect password"))
+ new FirebaseUIError(
+ ui.get(),
+ new FirebaseError(
+ "auth/wrong-password",
+ enUs.translations.errors!.wrongPassword!
+ )
+ )
)
.mockResolvedValueOnce({} as UserCredential);
@@ -444,7 +450,9 @@ describe("useSignInWithProvider", () => {
await result.current.callback();
});
- expect(result.current.error).toBe("Incorrect password");
+ expect(result.current.error).toBe(
+ enUs.translations.errors!.wrongPassword!
+ );
// Second call - should clear error
await act(async () => {
diff --git a/packages/shadcn/src/components/oauth-button.test.tsx b/packages/shadcn/src/components/oauth-button.test.tsx
index 9692ea7c..f24016d3 100644
--- a/packages/shadcn/src/components/oauth-button.test.tsx
+++ b/packages/shadcn/src/components/oauth-button.test.tsx
@@ -18,7 +18,7 @@ import { describe, it, expect, vi, afterEach, beforeEach } from "vitest";
import { render, screen, fireEvent, cleanup, waitFor } from "@testing-library/react";
import { OAuthButton } from "./oauth-button";
import { createMockUI } from "../../tests/utils";
-import { registerLocale } from "@firebase-oss/ui-translations";
+import { registerLocale, enUs } from "@firebase-oss/ui-translations";
import type { AuthProvider, UserCredential } from "firebase/auth";
import { ComponentProps } from "react";
@@ -268,7 +268,13 @@ describe("", () => {
// First call fails, second call succeeds
mockSignInWithProvider
.mockRejectedValueOnce(
- new FirebaseUIError(ui.get(), new FirebaseError("auth/wrong-password", "Incorrect password"))
+ new FirebaseUIError(
+ ui.get(),
+ new FirebaseError(
+ "auth/wrong-password",
+ enUs.translations.errors!.wrongPassword!
+ )
+ )
)
.mockResolvedValueOnce({} as UserCredential);
@@ -284,14 +290,20 @@ describe("", () => {
fireEvent.click(button);
await waitFor(() => {
- const errorMessage = screen.getByText("Incorrect password");
+ const errorMessage = screen.getByText(
+ enUs.translations.errors!.wrongPassword!
+ );
expect(errorMessage).toBeDefined();
});
// Second click - should clear error
fireEvent.click(button);
await waitFor(() => {
- expect(screen.queryByText("Incorrect password")).toBeNull();
+ expect(
+ screen.queryByText(
+ enUs.translations.errors!.wrongPassword!
+ )
+ ).toBeNull();
});
});
diff --git a/packages/translations/src/index.test.ts b/packages/translations/src/index.test.ts
index 667a9187..d898c557 100644
--- a/packages/translations/src/index.test.ts
+++ b/packages/translations/src/index.test.ts
@@ -678,7 +678,7 @@ describe("index.ts", () => {
it("should have valid error translations", () => {
const errors = enUs.translations.errors;
expect(errors?.userNotFound).toBe("No account found with this email address");
- expect(errors?.wrongPassword).toBe("Incorrect password");
+ expect(errors?.wrongPassword).toBe(enUs.translations.errors!.wrongPassword!);
expect(errors?.invalidEmail).toBe("Please enter a valid email address");
expect(errors?.unknownError).toBe("An unexpected error occurred");
});
diff --git a/packages/translations/src/locales/en-gb.ts b/packages/translations/src/locales/en-gb.ts
index aa681627..bcad2ab0 100644
--- a/packages/translations/src/locales/en-gb.ts
+++ b/packages/translations/src/locales/en-gb.ts
@@ -20,7 +20,8 @@ import { type Translations } from "../types";
export const enGB = {
errors: {
userNotFound: "No account found with this email address",
- wrongPassword: "Incorrect password",
+ wrongPassword:
+ "Incorrect email or password. If you previously signed in using another provider, try using that sign-in method instead.",
invalidEmail: "Please enter a valid email address",
userDisabled: "This account has been disabled",
networkRequestFailed: "Unable to connect to the server. Please check your internet connection",
diff --git a/packages/translations/src/locales/en-us.ts b/packages/translations/src/locales/en-us.ts
index f1f2e08c..c7103fac 100644
--- a/packages/translations/src/locales/en-us.ts
+++ b/packages/translations/src/locales/en-us.ts
@@ -20,7 +20,8 @@ import { type Translations } from "../types";
export const enUS = {
errors: {
userNotFound: "No account found with this email address",
- wrongPassword: "Incorrect password",
+ wrongPassword:
+ "Incorrect email or password. If you previously signed in using another provider, try using that sign-in method instead.",
invalidEmail: "Please enter a valid email address",
userDisabled: "This account has been disabled",
networkRequestFailed: "Unable to connect to the server. Please check your internet connection",
diff --git a/packages/translations/src/mapping.test.ts b/packages/translations/src/mapping.test.ts
index b6cff2b8..11ec89b4 100644
--- a/packages/translations/src/mapping.test.ts
+++ b/packages/translations/src/mapping.test.ts
@@ -154,7 +154,9 @@ describe("mapping.ts", () => {
expect(getTranslation(locale, "errors", "userNotFound")).toBe("Custom error message");
// Should fall back to English when not available
- expect(getTranslation(locale, "errors", "wrongPassword")).toBe("Incorrect password");
+ expect(getTranslation(locale, "errors", "wrongPassword")).toBe(
+ enUs.translations.errors!.wrongPassword!
+ );
expect(getTranslation(locale, "labels", "emailAddress")).toBe("Email Address");
});
diff --git a/packages/translations/src/types.ts b/packages/translations/src/types.ts
index 7cd41537..dcb2395d 100644
--- a/packages/translations/src/types.ts
+++ b/packages/translations/src/types.ts
@@ -44,7 +44,7 @@ export type Translations = {
errors?: {
/** Translation for when a user is not found. */
userNotFound?: string;
- /** Translation for incorrect password. */
+ /** Translation for incorrect password or OAuth accounts. */
wrongPassword?: string;
/** Translation for invalid email address. */
invalidEmail?: string;