FileUploader with uploadOnChange='true' and securityTokenAvailable problem
What is the issue and how can we reproduce it?
When using the FileUploader with uploadOnChange='true' will immediately start the upload. In the event 'uploadStart' you usually set some parameters like CSRFToken and other headers. Wanting to follow best practices, I used the asynchronous 'securityTokenAvailable' method which resolves a Promise when the CSRF Token is received.
If you synchronously get the CSRF Token, there is no issue. If you use the asynchronous method, a request will be launched before you receive the CSRF Token.
I don't think I can get you a reproducible project, since it requires access to a service that allows file uploads. Any ideas are welcome.
SAPUI5 1.120.38
Which OpenUI5 version is your project targeting?
1.120.38
Is the issue device- or browser-specific?
no
Confirmation
- [x] I have searched the existing issues and reviewed the relevant documentation as well as the API reference.
- [x] I am not disclosing any internal or sensitive information.
Hi @jvanattedev , thank you for your submission. From what I understand you have an issue with usage of oData asynchronous method "securityTokenAvailable", resolving befte it got the CSRFToken from the request sent by FileUploader? Thanks in advance for the clarification! Best regards, Petya Markova. UI5 Dispatcher.
Hi @jvanattedev , thank you for your submission. From what I understand you have an issue with usage of oData asynchronous method "securityTokenAvailable", resolving befte it got the CSRFToken from the request sent by FileUploader? Thanks in advance for the clarification! Best regards, Petya Markova. UI5 Dispatcher.
Yes. This is part of the code inside onUploadStart:
model.securityTokenAvailable() .then((csrfToken: string) => { // add csrf and other info to headers })
Hello @jvanattedev , Thank you for sharing this finding. I've created an internal incident DINC0679191. The status of the issue will be updated here in GitHub. Regards, Petya Markova. UI5 Dispatcher