From 6eb4cb647e0c2f2af96c9141bc7b53284ca1351d Mon Sep 17 00:00:00 2001 From: Liubin Jiang Date: Tue, 15 Jul 2025 13:53:08 -0700 Subject: [PATCH 1/3] add link domain to actionCodeSetting --- .../firebase/auth/ActionCodeSettings.java | 20 +++++++++++++++++++ .../google/firebase/auth/AuthErrorCode.java | 5 +++++ .../auth/internal/AuthErrorHandler.java | 7 +++++++ .../firebase/auth/ActionCodeSettingsTest.java | 4 ++-- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/google/firebase/auth/ActionCodeSettings.java b/src/main/java/com/google/firebase/auth/ActionCodeSettings.java index 0b102b7a3..6849d045b 100644 --- a/src/main/java/com/google/firebase/auth/ActionCodeSettings.java +++ b/src/main/java/com/google/firebase/auth/ActionCodeSettings.java @@ -51,6 +51,9 @@ private ActionCodeSettings(Builder builder) { if (!Strings.isNullOrEmpty(builder.dynamicLinkDomain)) { properties.put("dynamicLinkDomain", builder.dynamicLinkDomain); } + if (!Strings.isNullOrEmpty(builder.linkDomain)) { + properties.put("linkDomain", builder.linkDomain); + } if (!Strings.isNullOrEmpty(builder.iosBundleId)) { properties.put("iOSBundleId", builder.iosBundleId); } @@ -83,7 +86,9 @@ public static final class Builder { private String url; private boolean handleCodeInApp; + // Deprecated, use linkDomain instead. private String dynamicLinkDomain; + private String linkDomain; private String iosBundleId; private String androidPackageName; private String androidMinimumVersion; @@ -135,12 +140,27 @@ public Builder setHandleCodeInApp(boolean handleCodeInApp) { * * @param dynamicLinkDomain Firebase Dynamic Link domain string. * @return This builder. + * @deprecated Use {@link #setLinkDomain(String)} instead. */ public Builder setDynamicLinkDomain(String dynamicLinkDomain) { this.dynamicLinkDomain = dynamicLinkDomain; return this; } + /** + * Sets the link domain to use for the current link if it is to be opened using + * HandleCodeInApp, as multiple link domains can be configured per project. This + * setting provides the ability to explicitly choose one. If none is provided, the default + * Firebase Hosting domain will be used. + * + * @param linkDomain Link domain string. + * @return This builder. + */ + public Builder setLinkDomain(String linkDomain) { + this.linkDomain = linkDomain; + return this; + } + /** * Sets the bundle ID of the iOS app where the link should be handled if the * application is already installed on the device. diff --git a/src/main/java/com/google/firebase/auth/AuthErrorCode.java b/src/main/java/com/google/firebase/auth/AuthErrorCode.java index 90b5da1a2..9f7ecebf1 100644 --- a/src/main/java/com/google/firebase/auth/AuthErrorCode.java +++ b/src/main/java/com/google/firebase/auth/AuthErrorCode.java @@ -58,6 +58,11 @@ public enum AuthErrorCode { */ INVALID_DYNAMIC_LINK_DOMAIN, + /** + * The provided hosting link domain is not configured or authorized for the current project. + */ + INVALID_HOSTING_LINK_DOMAIN, + /** * The specified ID token is invalid. */ diff --git a/src/main/java/com/google/firebase/auth/internal/AuthErrorHandler.java b/src/main/java/com/google/firebase/auth/internal/AuthErrorHandler.java index 4b9523c83..bf322d203 100644 --- a/src/main/java/com/google/firebase/auth/internal/AuthErrorHandler.java +++ b/src/main/java/com/google/firebase/auth/internal/AuthErrorHandler.java @@ -73,6 +73,13 @@ final class AuthErrorHandler extends AbstractHttpErrorHandler expected = ImmutableMap.builder() .put("continueUrl", "https://example.com") .put("canHandleCodeInApp", true) - .put("dynamicLinkDomain", "myapp.page.link") + .put("linkDomain", "myapp.custom.link") .put("iOSBundleId", "com.example.ios") .put("androidPackageName", "com.example.android") .put("androidMinimumVersion", "6.0") From b77f33b1e7bc66b2258299caa70b582ccd9cdc64 Mon Sep 17 00:00:00 2001 From: jonathanedey Date: Fri, 8 Aug 2025 14:31:14 -0400 Subject: [PATCH 2/3] fix: Correct deprecation tag --- src/main/java/com/google/firebase/auth/ActionCodeSettings.java | 2 +- .../java/com/google/firebase/auth/ActionCodeSettingsTest.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/google/firebase/auth/ActionCodeSettings.java b/src/main/java/com/google/firebase/auth/ActionCodeSettings.java index 6849d045b..f4f4c2a38 100644 --- a/src/main/java/com/google/firebase/auth/ActionCodeSettings.java +++ b/src/main/java/com/google/firebase/auth/ActionCodeSettings.java @@ -86,7 +86,6 @@ public static final class Builder { private String url; private boolean handleCodeInApp; - // Deprecated, use linkDomain instead. private String dynamicLinkDomain; private String linkDomain; private String iosBundleId; @@ -142,6 +141,7 @@ public Builder setHandleCodeInApp(boolean handleCodeInApp) { * @return This builder. * @deprecated Use {@link #setLinkDomain(String)} instead. */ + @Deprecated public Builder setDynamicLinkDomain(String dynamicLinkDomain) { this.dynamicLinkDomain = dynamicLinkDomain; return this; diff --git a/src/test/java/com/google/firebase/auth/ActionCodeSettingsTest.java b/src/test/java/com/google/firebase/auth/ActionCodeSettingsTest.java index fe1cb628e..f79d83ba4 100644 --- a/src/test/java/com/google/firebase/auth/ActionCodeSettingsTest.java +++ b/src/test/java/com/google/firebase/auth/ActionCodeSettingsTest.java @@ -67,6 +67,7 @@ public void testAllSettings() { ActionCodeSettings settings = ActionCodeSettings.builder() .setUrl("https://example.com") .setHandleCodeInApp(true) + .setDynamicLinkDomain("myapp.page.link") .setLinkDomain("myapp.custom.link") .setIosBundleId("com.example.ios") .setAndroidPackageName("com.example.android") @@ -76,6 +77,7 @@ public void testAllSettings() { Map expected = ImmutableMap.builder() .put("continueUrl", "https://example.com") .put("canHandleCodeInApp", true) + .put("dynamicLinkDomain", "myapp.page.link") .put("linkDomain", "myapp.custom.link") .put("iOSBundleId", "com.example.ios") .put("androidPackageName", "com.example.android") From 6402eccb6ab717380d88894ff7cf393f26ecb459 Mon Sep 17 00:00:00 2001 From: jonathanedey Date: Mon, 25 Aug 2025 13:30:13 -0400 Subject: [PATCH 3/3] fix(auth): Fix doc string and use correct error message --- .../java/com/google/firebase/auth/ActionCodeSettings.java | 2 +- .../com/google/firebase/auth/internal/AuthErrorHandler.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/google/firebase/auth/ActionCodeSettings.java b/src/main/java/com/google/firebase/auth/ActionCodeSettings.java index f4f4c2a38..8ffccd542 100644 --- a/src/main/java/com/google/firebase/auth/ActionCodeSettings.java +++ b/src/main/java/com/google/firebase/auth/ActionCodeSettings.java @@ -149,7 +149,7 @@ public Builder setDynamicLinkDomain(String dynamicLinkDomain) { /** * Sets the link domain to use for the current link if it is to be opened using - * HandleCodeInApp, as multiple link domains can be configured per project. This + * {@code handleCodeInApp}, as multiple link domains can be configured per project. This * setting provides the ability to explicitly choose one. If none is provided, the default * Firebase Hosting domain will be used. * diff --git a/src/main/java/com/google/firebase/auth/internal/AuthErrorHandler.java b/src/main/java/com/google/firebase/auth/internal/AuthErrorHandler.java index bf322d203..346bd6a84 100644 --- a/src/main/java/com/google/firebase/auth/internal/AuthErrorHandler.java +++ b/src/main/java/com/google/firebase/auth/internal/AuthErrorHandler.java @@ -77,8 +77,8 @@ final class AuthErrorHandler extends AbstractHttpErrorHandler