I am currently developing a web application using Firebase.
I have encountered an issue with the Firebase Auth getRedirectResult
, which is consistently returning null when my app is running on Safari.
The front-end of my app is built with Next.js.
The expected behavior of the app is as follows:
- Upon clicking the "Sign in with Google" button on the login page, users should be redirected to
/auth-redirect?redirect_uri=onboarding
getRedirectResult
should initially return null, prompting the use ofsignInWithRedirect
for authentication- The authentication provider should then callback to
via Firebase/auth-redirect?redirect_uri=onboarding
- Afterwards,
getRedirectResult
should become non-null and direct the user to the specified redirect URI
However, I am facing an issue where the result of getRedirectResult
remains null at step 4 when using Safari. On Chrome, it behaves correctly by returning a non-null value.
The implementation of the auth-redirect
is outlined below:
// Code snippet not included for brevity
I am puzzled as to why
const result = await firebaseAuth.getRedirectResult(auth)
returns null only when Safari is being used.
When inspecting the logs in the web inspector, I notice that there is a peculiar WebSocket connection error specific to Safari:
WebSocket connection to 'ws://localhost:3000/_next/webpack-hmr' failed: WebSocket is closed due to suspension.
. However, I don't believe this is related to the issue since it pertains to HMR.
I would greatly appreciate any insights or advice you may have as I am unsure what factors to consider in resolving this discrepancy.
Information about my current environment:
- Safari version: 16.2 (18614.3.7.1.5)
- Chrome version: 109.0.5414.87(Official Build) (arm64)
- Next.js version: 13.0.6
- Firebase version: 9.8.1