Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
stefangerard opened this issue Apr 6, 2025 · 3 comments
Assignees

Comments

@stefangerard
Copy link

stefangerard commented Apr 6, 2025

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!
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@rizafran
Copy link
Contributor

rizafran commented Apr 7, 2025

Good catch! Thanks for reporting this, @stefangerard :)

@paulb777 paulb777 added this to the 11.12.0 - M163 milestone Apr 7, 2025
@rizafran
Copy link
Contributor

The fix has been merged and will be included in the next release. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants