Ionic React Firebase authentication with redirect returns to browser, not app

Firebase authentication works with web, and partly with with mobile too as it does authenticate with Google for example, but when it should return to app after successful authentication, it does not get back to app, but instead stays at browser and shows just a blank page, stating that site cannot be reached, with errorcode: ERR_CONNECTION_REFUSED, and url for that is localhost/login. This comes from the browser that the app opened to after

signInWithRedirect(auth, provider);

So the app itself is still there, waiting for the process to come back to it. But it stays in browser. What should I do to force it come back to app, not to localhost web address?

This question regards to Ionic 7 for React (18, React Router 5.3.4), Capacitor 5 and Firebase 10.4

Thanks @Hills90210 but I checked that already before posting here, and did not find there any relevant help. Might be missing something, but:
Option 1: does not help with android, it is not a google hosted website.
Option 2: not good for mobiles.
Option 3: Works mostly on servers, not mobiles. Maybe deep links could be used instead in mobiles, but those didn’t help either.
Option 4: Doesn’t work with Apple sign-in so not good option for mobiles either. Also, would require redownloanding and resetting everytime google changes codes.
Option 5: Requires doing in a way without firebase. While might be doable, I wonder if it really is only option to use firebase auth with mobiles: to not to use firebase auth methods, but others and then just to again connect with them. Edit: was my choice of possible solution too, but thought to check here before going forward with this.

Hence, I posted it in here in case someone has experience of already getting it to work. Have you got it to work with some of those methods? If so, please advice further.

I believe you need to use a plugin