I'm currently transitioning from using Firebase's signInWithPopup
method to the signInWithRedirect
method.
After reading through the best practices outlined in this documentation, I realized that not following these practices can result in successful login via Chrome, but issues may arise when trying to sign in using Firefox and Safari. By implementing Option #3 from the documentation (which involves changing the authDomain
in Firebase configuration to point to our servers and adding a proxy to rewrite URLs to Firebase's domain), I was able to achieve cross-browser compatibility in my development environment using a real Firebase project instead of an emulation.
The problem arises in the staging environment where multiple deployments with unique URLs all point to the main staging URL as the authDomain
. Since each deployment has its own unique URL, I cannot add them all to Google's OAuth list, leading them all to redirect to "www.staging.com" instead of their individual URLs like "www.randomUrl123.com". Unfortunately, signing in does not work on "www.randomUrl123.com" as intended. It redirects to Google and then back to "www.randomUrl123.com", but no actual sign-in occurs, with getRedirectResult
returning null
without any errors being thrown or logged in the browser console.
I am at a loss for how to proceed or debug this issue. Any suggestions on possible solutions?