react-native-aws3 icon indicating copy to clipboard operation
react-native-aws3 copied to clipboard

Ability to presign

Open sebringj opened this issue 8 years ago • 4 comments

Send networked presigned from server to avoid having to set secret and also have programatic control over user's namespace.

sebringj avatar Mar 05 '17 18:03 sebringj

It would be awesome if this important feature gets implemented in the library! @sebringj ; where do I set the presigned url? in options as presigned? and have you tested it, does it work?

YousefMohsen avatar Nov 07 '17 14:11 YousefMohsen

@YousefMohsen hi, to get a presigned url, you can use this to get you started: https://github.com/sebringj/siggy what you do is in your code is just in time request to get this presigned one, then proceed with upload passing in presigned header. You'll have to modify this repo to inject the right headers for your security along with modifying the example code to check the header for a token or whatever security thing you are doing to ensure the user is signed in. My code is proprietary otherwise would give put up for you to use. My stuff is in production and works but doesn't do you any good, sorry but hope this gets you going.

onPress={() => getPresignedUrl()
.then(signingInfo => doUpload(signingInfo))
.then(done)}

type scenario

sebringj avatar Nov 07 '17 15:11 sebringj

Im using the aws-sdk s3.getSignedUrl('putObject',params,callback) to generate presigned urls. I just cant figure out how to use that url to upload files in proper format. I tried to use axios and it uploads to the bucket, but saves the image as a json object.. Anyways thanks for your help:) and i hope to see the presigned url feature in the RNS3 library one day.

YousefMohsen avatar Nov 07 '17 16:11 YousefMohsen

hey @sebringj , I made a fork of this package and merged your PR for myself. One question though. I'm seeing that you're passing signature as one of your parameters. How do you get that?

I'm using aws-sdk-js on my server to generate the signedUrl, which returns a full url including the signature. Do you strip it from there?

arrygoo avatar Apr 18 '18 19:04 arrygoo