File Uploader security settings
Signed uploads
Signed uploads control who can upload files to your project. Your backend issues a credential, the uploader sends it with every Upload API request, and Uploadcare rejects anything without one.
Set authToken to a function that
fetches a token from your backend. This needs File Uploader 1.35.1 or later.
Versions that predate the option ignore it without a warning and the upload
goes out unsigned.
The uploader caches the token and replaces it 30 seconds before it expires, so
this runs once rather than once per request. When Uploadcare refuses a token as expired
or spent, the uploader drops it, asks your function for another and retries
that upload once. See signed
uploads for enabling the feature, issuing
tokens, and limiting one to particular endpoints or a number of operations.
If you use the AI Image Editor plugin,
it sends the same token. Generation has its own setting,
Signed AI image generation,
which is on by default, so the plugin needs authToken even when uploads are unsigned.
If your function throws, the file fails to upload with an AUTH_TOKEN_ERROR,
separate from the errors Uploadcare itself reports: it means your token endpoint
is unreachable or the user’s session is gone. The thrown failure is on
payload.error.cause. See handling a failing token
function.
When Uploadcare refuses the token, the file fails with an UPLOAD_ERROR
instead, and the server’s code (ScopeForbiddenError,
OperationsLimitExceededError and so on) is on payload.error.code:
Projects still on the legacy signature and expire parameters set
secureSignature and
secureExpire directly, or use
secureUploadsSignatureResolver
to fetch a fresh signature before the old one expires. See
signed uploads with a signature for
generating one, and moving from signatures
for moving over.
Secure delivery proxy
There are two ways to point File Uploader to a signing proxy:
- Using the
secureDeliveryProxyoption:
The secureDeliveryProxy parameter can be used with
signed URLs. It defines a URL template
for your signing proxy.
Value for secureDeliveryProxy is a string template with the following
variables:
previewUrl
That means that you can use {{previewUrl}} in your template to insert the URL
of a file to proxify.
- Using the
secureDeliveryProxyUrlResolveroption:
This function should return a signing proxy URL.
CSP settings
If your application handles sensitive user data (e.g., personal photos),
we recommend enhancing its security through CSP settings.
The File Uploader uses Blob URLs for on-the-fly image generation and stylesheets in some cases.
Consequently, remember to add blob: as a source in the CSP settings:
ucarecdn.com is kept for legacy purposes only; use ucarecd.net going forward.