Do you have a recommended flow, for fetching a signature when doing signed uploads? #406
Unanswered
alexbjorlig
asked this question in
blocks
Replies: 2 comments
-
Yes, your option is great, but we cannot await data provided by third-party API inside of the file uploading process, because we don't know if that API works fast and correctly. So, for example, you can get a newly signed token on page loading or if you use inline mode inserted in your own modal window - when the modal window is opened. |
Beta Was this translation helpful? Give feedback.
0 replies
-
BTW, you are also able to write some additional metadata for uploading files, when a page or a modal is initialized, e.g.: if (this.dialogVisible) {
await connectBlocksFrom ('https://unpkg.com/@uploadcare/[email protected]/web/blocks-browser.min.js')
.then (() => {
let uploaderCtx = this.$refs.uploaderctx
let uploader = this.$refs.uploader
this.$api.files.getSignature ()
.then (_ => {
uploaderCtx.setUploadMetadata ({
company: _.data.company,
user: _.data.user,
project: _.data.project
})
uploader.style.setProperty ('--cfg-secure-signature', `"${_.data.signature}"`)
uploader.style.setProperty ('--cfg-secure-expire', `"${_.data.expire}"`)
})
})
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The most ideal thing (if you ask me) would be:
Do you have an example of the above?
Beta Was this translation helpful? Give feedback.
All reactions