Skip to content

Incorrect query parameter key used for language code in ActionCodeURL (languageCode instead of lang) #14664

Closed
@stefangerard

Description

@stefangerard

Description

In FirebaseAuth/Sources/Swift/ActionCode/ActionCodeURL.swift, the language code is extracted using the key "languageCode" from the query parameters. However, according to the official Firebase documentation, the correct query parameter key for the language code is "lang".

Firebase documentation for custom email handlers specifies the parameter name as lang:
https://firebase.google.com/docs/auth/custom-email-handler#create_the_email_action_handler_page

This discrepancy leads to the languageCode property in ActionCodeURL being nil even when the URL contains a valid lang parameter.

File/Code Reference:
https://github.com/firebase/firebase-ios-sdk/blob/HEAD/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeURL.swift#L59

// Current code
languageCode = queryItems["languageCode"]

// Suggested fix
languageCode = queryItems["lang"]

Reproducing the issue

  1. Send a Firebase email (e.g., password reset) with a specific language code (e.g., lang=de).
  2. Open the link in the email and pass it to ActionCodeURL(link:).
  3. Observe that languageCode is nil, despite the lang parameter being present in the URL.

Example URL

https://example.page.link/?mode=resetPassword&oobCode=abc123&lang=de

Expected behavior:
ActionCodeURL.languageCode == "de"

Actual behavior:
ActionCodeURL.languageCode == nil

Firebase SDK Version

11.11.0

Xcode Version

16.3

Installation Method

Swift Package Manager

Firebase Product(s)

Authentication

Targeted Platforms

All

Relevant Log Output

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions