Firebase console → Authentication → Settings → Authorized domains → Add domain. Add both mydomain.com and www.mydomain.com if you use both.
And put authDomain back to yourproject.firebaseapp.com. Pointing authDomain at your own domain only works if that domain serves Firebase's /__/auth/ handler (which it does on Firebase Hosting with extra setup), that's why you got a 404.