In order to download an asset an Authorization header needs to be set when using react-native-fs with React Native.
Following the documentation the header is set as such:
const options = {
headers: {
Authorization: `Bearer ${accessToken}`,
},
fromUrl: url,
toFile: path,
};
// const permission = await insurePermissions();
const task = RNFS.downloadFile(options);
It works perfect in iOS however Android, using an emulator running either Android 6, 8, 9, or 10, the header isn't being sent so the server is instead returning a different asset with error because the user isn't being authenticated.
How is the Authentication header set in Android with react-native-fs?