-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🚀 [auth] Allow setting custom auth domain for default app #8280
Comments
I think you're right, I don't see the current code for setting custom auth domain hooked up for default app anywhere Not sure how best to handle this while maintaining fidelity with firebase-js-sdk API as there is a real mismatch here between firebase-js-sdk (where you pass it in config for FirebaseApp with no Auth API usage) and native (where you set it directly on Auth, and App does not know about it). We could just expose a native-specific Auth method as you mention and that seems like a reasonable fallback position, however the ideal solution would be to keep it in the config as mentioned in upstream docs and as used for secondary apps, and just handle it somehow. Resolution of this choice depends on some analysis to see if we can get the low-level config from google plist/json for the default app in ios and android bootstrap, and if it still contains |
I did a little more analysis on this, findings: 1- - the native "options" objects you use to configure the native FirebaseApp's do not have space for authDomain What I take from the above two items is that we cannot just counsel people to add So adding it to native config is out. 3- the native FirebaseApp configure methods (at least iOS...) do not allow you to call them multiple times Thus, it's a little unnatural to call it again at the javascript level, however it is possible, and we could add logic to our FirebaseApp.configure method to see if there was an Upside to this is that it's how the firebase-js-sdk configuration options looks in the first place, so ... maybe it makes sense The only other alternative is to directly expose a react-native-firebase-only API like Between the two, I lean towards firebase-js-sdk fidelity so I'd go with requiring a second configure call at app startup with authDomain in the config object to match firebase-js-sdk |
Okay, final analysis for the day, the first spot to change to implement authDomain for default app, assuming we go with firebase-js-sdk compatibility and we require react-native-firebase/packages/app/lib/internal/web/RNFBAppModule.js Lines 64 to 66 in b39f5a4
That should be it. If initializeApp is called early enough in bootstrap - prior to an auth instance being configured, then it will look for an authDomain for it's appName in the map as it is instantiated and things will be hooked up. |
#7530 added support for setting the auth domain when calling
initializeApp
, but since we never do that manually for the default app that solution doesn't help in that case. #7523 (comment) claims that you can set it through yourGoogleServices-Info.plist
/google-services.json
instead. Correct me if I'm wrong, but this doesn't seem to actually be the case. https://cloud.google.com/identity-platform/docs/show-custom-domain#java only shows ways to do it at runtime and I haven't gotten it to work through the config files.For this reason it would be useful if the auth instance exposed something like a
setCustomAuthDomain
function that took in the auth domain and just proxied to those native functions to set it.The text was updated successfully, but these errors were encountered: