filestack / filestack-react

Official React component for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.
https://www.filestack.com
MIT License
164 stars 40 forks source link

Unauthorized request [403, 401] Status codes when uploading files #86

Closed Juan-escobar94 closed 4 years ago

Juan-escobar94 commented 4 years ago

Heyo filestack community. Im plugging in the filestack component into my react application in the following manner:

<ReactFilestack
         apikey={MY_API_KEY}
          onSuccess={(res) => console.log(res)}/>

The response headers I am getting from the filestack server are the following:

Prefetch:

Request URL: https://upload.filestackapi.com/prefetch Request Method: POST Status Code: 200 OK Remote Address: 18.200.162.159:443 Referrer Policy: no-referrer-when-downgrade

the response body:

{"blocked":false,"settings":{"inapp_browser":false},"permissions":{"intelligent_ingestion":false,"whitelabel":false},"updated_config":{"concurrency":4,"displayMode":"overlay","errorsTimeout":5000,"fromSources":["local_file_system","url","imagesearch","facebook","instagram","googledrive"],"lang":"en","loadCss":"https://static.filestackapi.com/picker/1.15.0/main.css","maxFiles":1,"minFiles":1,"rootId":"__filestack-picker","supportEmail":"","transformations":{"circle":true,"crop":{},"rotate":true},"uploadInBackground":true,"useSentryBreadcrumbs":true,"viewType":"list"}}
List:

Request URL: https://cloud.filestackapi.com/folder/list Request Method: POST Status Code: 401 Unauthorized Remote Address: 34.200.56.215:443 Referrer Policy: no-referrer-when-downgrade

the response body:

{"error":"invalid policy"}
Start:

Request URL: https://upload.filestackapi.com/multipart/start Request Method: POST Status Code: 403 Forbidden Remote Address: 18.200.162.159:443 Referrer Policy: no-referrer-when-downgrade

response body:

{"error":"invalid policy: proper credentials were not provided: (signature: \"\"; policy \"\")","timestamp":1590158698}

I can see on each request payload that my api key is being sent, I dont really understand why the 401 status code and in the start req "proper credentials were not provided"

Am I missing something?

Juan-escobar94 commented 4 years ago

closed, we were using security in our app (which I didnt know :see_no_evil: ), and I needed to initialize my React Component with:

<ReactFilestack
  apikey="myapikey"
  clientOptions={{
       security: {
         policy: myFilestackCredentials.policy,
         signature: myFilestackCredentials.signature
       }
   }}
/>
myoneflag commented 3 years ago

policy: myFilestackCredentials.policy, signature: myFilestackCredentials.signature Please let me know about this in detail. Thank you