From 32af2b8141bddb7230dd4db7e6612703f2dfc25b Mon Sep 17 00:00:00 2001 From: Lahiru Maramba Date: Thu, 22 Jun 2023 18:05:56 -0400 Subject: [PATCH 1/6] [chore] Release 4.12.0 (#561) - Release 4.12.0 --- firebase.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firebase.go b/firebase.go index a06829b1..fb3b0b47 100644 --- a/firebase.go +++ b/firebase.go @@ -39,7 +39,7 @@ import ( var defaultAuthOverrides = make(map[string]interface{}) // Version of the Firebase Go Admin SDK. -const Version = "4.11.0" +const Version = "4.12.0" // firebaseEnvName is the name of the environment variable with the Config. const firebaseEnvName = "FIREBASE_CONFIG" From 02300a8e865290c35d0ff92ff241ee38ccd814a7 Mon Sep 17 00:00:00 2001 From: Lahiru Maramba Date: Tue, 11 Jul 2023 12:21:57 -0400 Subject: [PATCH 2/6] Revert "[chore] Release 4.12.0 (#561)" (#565) This reverts commit 32af2b8141bddb7230dd4db7e6612703f2dfc25b. --- firebase.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firebase.go b/firebase.go index fb3b0b47..a06829b1 100644 --- a/firebase.go +++ b/firebase.go @@ -39,7 +39,7 @@ import ( var defaultAuthOverrides = make(map[string]interface{}) // Version of the Firebase Go Admin SDK. -const Version = "4.12.0" +const Version = "4.11.0" // firebaseEnvName is the name of the environment variable with the Config. const firebaseEnvName = "FIREBASE_CONFIG" From 523615021baf2d65507eeb7a5d81fe6ad1750c36 Mon Sep 17 00:00:00 2001 From: Graeme Browning Date: Wed, 9 Apr 2025 11:05:19 -0400 Subject: [PATCH 3/6] Add LinkDomain to ActionCodeSettings --- auth/email_action_links.go | 1 + auth/email_action_links_test.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/auth/email_action_links.go b/auth/email_action_links.go index 6b649254..c2c10142 100644 --- a/auth/email_action_links.go +++ b/auth/email_action_links.go @@ -31,6 +31,7 @@ type ActionCodeSettings struct { AndroidPackageName string `json:"androidPackageName,omitempty"` AndroidMinimumVersion string `json:"androidMinimumVersion,omitempty"` AndroidInstallApp bool `json:"androidInstallApp,omitempty"` + LinkDomain string `json:"linkDomain,omitempty"` DynamicLinkDomain string `json:"dynamicLinkDomain,omitempty"` } diff --git a/auth/email_action_links_test.go b/auth/email_action_links_test.go index 876f3300..30173fa0 100644 --- a/auth/email_action_links_test.go +++ b/auth/email_action_links_test.go @@ -35,6 +35,7 @@ var testActionLinkResponse = []byte(fmt.Sprintf(testActionLinkFormat, testAction var testActionCodeSettings = &ActionCodeSettings{ URL: "https://example.dynamic.link", HandleCodeInApp: true, + LinkDomain: "hosted.page.link", DynamicLinkDomain: "custom.page.link", IOSBundleID: "com.example.ios", AndroidPackageName: "com.example.android", @@ -44,6 +45,7 @@ var testActionCodeSettings = &ActionCodeSettings{ var testActionCodeSettingsMap = map[string]interface{}{ "continueUrl": "https://example.dynamic.link", "canHandleCodeInApp": true, + "linkDomain": "hosted.page.link", "dynamicLinkDomain": "custom.page.link", "iOSBundleId": "com.example.ios", "androidPackageName": "com.example.android", From a7de2469324a0d7bf6faedcab4764f28eb0e65a8 Mon Sep 17 00:00:00 2001 From: Graeme Browning Date: Tue, 22 Jul 2025 16:23:27 -0400 Subject: [PATCH 4/6] Handle INVALID_HOSTING_LINK_DOMAIN --- auth/email_action_links_test.go | 1 + auth/user_mgt.go | 11 +++++++++++ auth/user_mgt_test.go | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/auth/email_action_links_test.go b/auth/email_action_links_test.go index 30173fa0..2575ff32 100644 --- a/auth/email_action_links_test.go +++ b/auth/email_action_links_test.go @@ -295,6 +295,7 @@ func TestEmailVerificationLinkError(t *testing.T) { cases := map[string]func(error) bool{ "UNAUTHORIZED_DOMAIN": IsUnauthorizedContinueURI, "INVALID_DYNAMIC_LINK_DOMAIN": IsInvalidDynamicLinkDomain, + "INVALID_HOSTING_LINK_DOMAIN": IsInvalidHostingLinkDomain, } s := echoServer(testActionLinkResponse, t) defer s.Close() diff --git a/auth/user_mgt.go b/auth/user_mgt.go index 601c1e03..bd132f3f 100644 --- a/auth/user_mgt.go +++ b/auth/user_mgt.go @@ -522,6 +522,7 @@ const ( emailAlreadyExists = "EMAIL_ALREADY_EXISTS" emailNotFound = "EMAIL_NOT_FOUND" invalidDynamicLinkDomain = "INVALID_DYNAMIC_LINK_DOMAIN" + invalidHostingLinkDomain = "INVALID_HOSTING_LINK_DOMAIN" phoneNumberAlreadyExists = "PHONE_NUMBER_ALREADY_EXISTS" tenantNotFound = "TENANT_NOT_FOUND" uidAlreadyExists = "UID_ALREADY_EXISTS" @@ -556,6 +557,11 @@ func IsInvalidDynamicLinkDomain(err error) bool { return hasAuthErrorCode(err, invalidDynamicLinkDomain) } +// IsInvalidHostingLinkDomain checks if the given error was due to an invalid hosting link domain. +func IsInvalidHostingLinkDomain(err error) bool { + return hasAuthErrorCode(err, invalidHostingLinkDomain) +} + // IsInvalidEmail checks if the given error was due to an invalid email. // // Deprecated: Always returns false. @@ -1447,6 +1453,11 @@ var serverError = map[string]*authError{ message: "the provided dynamic link domain is not configured or authorized for the current project", authCode: invalidDynamicLinkDomain, }, + "INVALID_HOSTING_LINK_DOMAIN": { + code: internal.InvalidArgument, + message: "the provided hosting link domain is not configured or authorized for the current project", + authCode: invalidHostingLinkDomain, + }, "PHONE_NUMBER_EXISTS": { code: internal.AlreadyExists, message: "user with the provided phone number already exists", diff --git a/auth/user_mgt_test.go b/auth/user_mgt_test.go index 97e64c39..cf841502 100644 --- a/auth/user_mgt_test.go +++ b/auth/user_mgt_test.go @@ -2151,6 +2151,11 @@ func TestHTTPErrorWithCode(t *testing.T) { errorutils.IsInvalidArgument, "the provided dynamic link domain is not configured or authorized for the current project", }, + "INVALID_HOSTING_LINK_DOMAIN": { + IsInvalidHostingLinkDomain, + errorutils.IsInvalidArgument, + "the provided hosting link domain is not configured or authorized for the current project", + }, "PHONE_NUMBER_EXISTS": { IsPhoneNumberAlreadyExists, errorutils.IsAlreadyExists, From e38466208f4dfc5298dcd910c73ff5ba3ab182e8 Mon Sep 17 00:00:00 2001 From: Graeme Browning Date: Tue, 22 Jul 2025 16:28:22 -0400 Subject: [PATCH 5/6] Mark DynamicLinkDomain as deprecated --- auth/email_action_links.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/auth/email_action_links.go b/auth/email_action_links.go index c2c10142..282e79fe 100644 --- a/auth/email_action_links.go +++ b/auth/email_action_links.go @@ -32,7 +32,8 @@ type ActionCodeSettings struct { AndroidMinimumVersion string `json:"androidMinimumVersion,omitempty"` AndroidInstallApp bool `json:"androidInstallApp,omitempty"` LinkDomain string `json:"linkDomain,omitempty"` - DynamicLinkDomain string `json:"dynamicLinkDomain,omitempty"` + // Deprecated: Use LinkDomain instead. + DynamicLinkDomain string `json:"dynamicLinkDomain,omitempty"` } func (settings *ActionCodeSettings) toMap() (map[string]interface{}, error) { From c0bc26f4426484b82be152c65f51dcb4afc6f200 Mon Sep 17 00:00:00 2001 From: Graeme Browning Date: Wed, 23 Jul 2025 13:36:40 -0400 Subject: [PATCH 6/6] Better error message for INVALID_HOSTING_LINK_DOMAIN --- auth/user_mgt.go | 2 +- auth/user_mgt_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/auth/user_mgt.go b/auth/user_mgt.go index bd132f3f..63a5c381 100644 --- a/auth/user_mgt.go +++ b/auth/user_mgt.go @@ -1455,7 +1455,7 @@ var serverError = map[string]*authError{ }, "INVALID_HOSTING_LINK_DOMAIN": { code: internal.InvalidArgument, - message: "the provided hosting link domain is not configured or authorized for the current project", + message: "the provided hosting link domain is not configured in Firebase Hosting or is not owned by the current project", authCode: invalidHostingLinkDomain, }, "PHONE_NUMBER_EXISTS": { diff --git a/auth/user_mgt_test.go b/auth/user_mgt_test.go index cf841502..53ccdc58 100644 --- a/auth/user_mgt_test.go +++ b/auth/user_mgt_test.go @@ -2154,7 +2154,7 @@ func TestHTTPErrorWithCode(t *testing.T) { "INVALID_HOSTING_LINK_DOMAIN": { IsInvalidHostingLinkDomain, errorutils.IsInvalidArgument, - "the provided hosting link domain is not configured or authorized for the current project", + "the provided hosting link domain is not configured in Firebase Hosting or is not owned by the current project", }, "PHONE_NUMBER_EXISTS": { IsPhoneNumberAlreadyExists,