Vydia / react-native-background-upload

Upload files in your React Native app even while it's backgrounded. Supports Android and iOS, including camera roll assets.
MIT License
723 stars 330 forks source link

Can't set Authorization header #225

Open SteveTro opened 3 years ago

SteveTro commented 3 years ago

i try to upload files to the google storage json api. I get the token from a cloud function but when i try to upload the images like this:

this.options = {
        customUploadId: _uploadID,
        url: url,
        path: path,
        method: 'POST',
        type: 'raw',

        header: {
          "Authorization": `Bearer ${token}`,
          'content-type': 'application/octet-stream',
        },
};

i always get an error 401 "Anonymous caller does not have storage.objects.create access to the Google Cloud Storage object." If i try the request in postman everything works fine.

How are the headers added?

reime005 commented 3 years ago

@SteveTro it should be called "headers"