We’re looking at moving an existing RN project to Expo. It seems mostly perfect for us, but we could use a bit of advice.
In our current version of the app we have some native code, mostly for dealing with multi-environment (dev/stage/prod) setups in specific per-env builds. We think we should be able to replicate the per-env configurations by using Expo release channels, but we’re not sure how to deal with adding Authorization: headers to “normal” HTTP requests triggered by the app, e.g. for images or data files stored behind basic auth on dev and stage environments.
Right now we do this in per-target build scheme scripts on iOS, by overriding sendRequest: withDelegate: in RCTHTTPRequestHandler.m, and by implementing a custom HTTP Interceptor on Android. This way any HTTP requests our app makes to our dev/stage environments have the Authorization: header automatically added, using per-environment/build target credentials taken from config in Info.plist or build.gradle.
Not sure how we’d go about this in Expo. I’m guessing it’d need to have similar overrides as part of the underlying RN bundle, with some way of exposing them for host/credential configuration in the JS code, which I imagine would probably be done better by someone closer to the RN code.
Has anyone else come up against this? Is this something to raise a feature request for? Or how else should we approach it? We’ve considered using IP-based instead of basic auth, but that would be considerably less convenient for us, as we have devs working behind dynamic IPs, etc, and as even dev & stage are over HTTPS, basic auth is a decent option for us.
Thanks for any input!