FG
๐Ÿ”Œ APIs & SDKsGoogle

Login to Firebase does not work on Safari 16.1+

Freshabout 20 hours ago
Mar 14, 20260 views
Confidence Score95%
95%

Problem

Describe your environment Operating System version: Mac OS 12.6 Browser version: Safari 16.1 Firebase SDK version: 9.10.0 Firebase Product: auth Describe the problem Steps to reproduce: Try logging in to a site using `signInWithRedirect`. Notably it redirects back to the site without an error, and does not log the user in. Checking `getRedirectResult` returns a null user. This seems like a severe issue as iOS 16.1 will be released next week and presumably this issue will affect all those iOS users. Notably there seems to be a workaround of using `signInWithPopup`. It seems to work for us, though it is unclear why. Relevant Code: [code block]

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix โ€“ Awaiting Verification

Implement Workaround for Firebase Auth on Safari 16.1+

Medium Risk

The issue arises due to a compatibility problem between Firebase SDK version 9.10.0 and Safari 16.1+, which affects the handling of redirects during authentication. This results in `getRedirectResult` returning null, preventing users from logging in successfully. The workaround using `signInWithPopup` bypasses this issue as it does not rely on the redirect mechanism that is failing.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Update Firebase SDK

    Check if there is a newer version of the Firebase SDK that addresses compatibility issues with Safari 16.1+. If available, update the SDK in your project.

    bash
    npm install firebase@latest
  2. 2

    Switch to signInWithPopup

    Modify your authentication code to use `signInWithPopup` instead of `signInWithRedirect`. This will allow users to log in without being affected by the redirect issue.

    typescript
    const provider = new firebase.auth.GoogleAuthProvider();
    firebase.auth().signInWithPopup(provider).then((result) => {
      // Handle successful login
    }).catch((error) => {
      // Handle errors
    });
  3. 3

    Test Authentication Flow

    After implementing the changes, test the authentication flow on Safari 16.1+ to ensure that users can log in successfully using the popup method.

  4. 4

    Monitor User Feedback

    Collect feedback from users regarding the login process to ensure that the workaround is functioning as expected and that there are no further issues.

Validation

To confirm the fix worked, attempt to log in using Safari 16.1+ after implementing the changes. Successful login should redirect to the application without returning null from `getRedirectResult`. Additionally, gather user feedback to ensure no further issues arise.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

firebasegooglesdkapi:-authneeds-info