upload with credentials

1 Answer 114 Views
Upload
Daniela
Top achievements
Rank 1
Iron
Iron
Iron
Daniela asked on 27 Oct 2021, 11:02 AM

Hello,

 

I cannot find an example of the upload with credentials where I can pass an authorization token in the header of the request, some help would be appreciated.

https://www.telerik.com/kendo-react-ui/components/upload/credentials/

 

Thanks,

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 28 Oct 2021, 12:42 PM

Hello, Daniela,

This prop is used to determine if these credentials will be sent:

https://www.telerik.com/kendo-react-ui/components/upload/api/UploadProps/#toc-withcredentials

To add specific information to the request the developer can use the saveHeaders and removeHeaders props. They are sent in kye - value pair format:

https://www.telerik.com/kendo-react-ui/components/upload/api/UploadProps/#toc-saveheaders

https://www.telerik.com/kendo-react-ui/components/upload/api/UploadProps/#toc-removeheaders

Also, the additional information can be passed using this approach:

https://www.telerik.com/kendo-react-ui/components/upload/credentials/#toc-attaching-additional-data-to-requests

Regards,
Stefan
Progress Telerik

Remote troubleshooting is now easier with Telerik Fiddler Jam. Get the full context to end-users' issues in just three steps! Start your trial here - https://www.telerik.com/fiddler-jam.
Daniela
Top achievements
Rank 1
Iron
Iron
Iron
commented on 29 Oct 2021, 07:01 AM

Hello,

 

Thanks a lot for the response, do you probably know how can I add information in the body of the request?

Thanks,

Stefan
Telerik team
commented on 29 Oct 2021, 07:42 AM

Hello, Daniela,

Currently, these are the option to add specific information to the request.

Please share more details on which information and where has to be added. You can demonstrate the requirement on a standard request and we will advise how and if this can be added to the Upload request.

Daniela
Top achievements
Rank 1
Iron
Iron
Iron
commented on 29 Oct 2021, 07:45 AM

Hello,

 

Below is an example of an upload request of how I am supposed to upload the files, if you see I have to add a lot of info into the body. Thanks

Stefan
Telerik team
commented on 29 Oct 2021, 01:55 PM

Hello, Daniela,

If the developer has to add different custom information, we can also suggest using the savelUrl as a function where the developer has full control over the request. This will allow adding any required parameters and making the request:

https://stackblitz.com/edit/react-bvfjbb-bgahfr?file=app/main.jsx

Please have in mind that the example shows only a mock of a request as we do not have a public server that can accept a request.
Daniela
Top achievements
Rank 1
Iron
Iron
Iron
commented on 01 Nov 2021, 01:57 PM

Hello,

 

Sorry I did not understand that example, where exactly can I add the parameters to the body in your example?

thanks a lot.

Stefan
Telerik team
commented on 02 Nov 2021, 07:22 AM

Hello, Daniela,

The example is demonstrating how the developer can make the request themselves. This means the actual request to the API will be made by the developer with fetch, axios, or any other tool.

Also, our example with additional data, show how to pass extra parameters to the request:

https://stackblitz.com/edit/react-y5sixt?file=app/main.jsx

Daniela
Top achievements
Rank 1
Iron
Iron
Iron
commented on 02 Nov 2021, 01:08 PM

Hello,

 

Thaks for your response, do you know if I can change the name "files" to "file" in the payload of the upload?

 

Thank you

Stefan
Telerik team
commented on 03 Nov 2021, 05:57 AM

Hello, Daniela,

Currently, the name is fixed to `files`.

I can suggest updating the server API to expect `files` instead of `file`.

Daniela
Top achievements
Rank 1
Iron
Iron
Iron
commented on 03 Nov 2021, 09:43 AM

Apparently I cannot change it because its an amazon s3 bucket configuration. Are you sure I cannot chnage it ? 
Stefan
Telerik team
commented on 03 Nov 2021, 11:10 AM

Hello, 

Yes, I'm sure that there is no public API property that is available for changing the files field.

The only other option is the one offered on  29 Oct 2021 to use the saveURL as a function and make the request programmatically:

https://stackblitz.com/edit/react-bvfjbb-bgahfr?file=app/main.jsx

This will require the developer to make the request using their preferred method.

Tags
Upload
Asked by
Daniela
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Stefan
Telerik team
Share this question
or