Home > front end >  S3 returns 403 when trying to download file from Android Emulator
S3 returns 403 when trying to download file from Android Emulator

Time:07-01

I'm developing an Android app with React Native and I have ran into a problem with S3. I'm running the app on an emulator, and trying to download a file through a presigned URL from localstack. I've tried to do so with RNFS and RNFetchBlob, none of them worked. With both libs, S3 gives this message:

Presign signature calculation failed: <Response [403]>

I'm sending my request to 10.0.2.2:4566 instead of 127.0.0.1:4566, because the app can't connect to the latter (because it runs on an emulator).

I can access the URL through my browser, but I can't make it work on the emulator. What am I missing?

CodePudding user response:

Check your emulator date and time. The signature is time dependent so your emulator time should be correct.

CodePudding user response:

Finally figured it out. I had to configure on the backend that localstack should use my PC's IP, and access the files on the Emulator through that. This way the GET request is successful.

# AWS - localstack
aws.endpoint.url = http://192._._._:4566
  • Related