Yes, It is possible to upload or fetch resources that are password protected with Cloudinary.
How this is accomplished depends on how you're uploading the resources.
Upload API
Specify the username and password as part of the URL you supply when calling the Upload API using our SDKs. This is supported for HTTP/HTTPS URLs, and FTP URLs.
Ruby on Rails SDK examples:
HTTPS URL
Cloudinary::Uploader.upload("https://user:password@www.example.com/sample.jpg")
FTP URL
Cloudinary::Uploader.upload("ftp://user1:mypass@ftp.example.com/sample.jpg")
Fetch
Provide the username and password as part of the HTTP/HTTPS URL of the resource when using the /fetch/ URL component to specify a remote URL to be fetched.
https://res.cloudinary.com/<cloudname>/image/fetch/https://<username>:<password>@<url>
Note <url> excludes `http://` and `https://`.
Because this includes the remote username and password in the user-visible URL, we do not recommend using URLs like this in publicly-accessible code.
Auto Upload
Specify the URL including the username and password, in the auto upload mapping section of the upload settings.
Configure the parameters as follows:
- Folder set to a value of your choice, for example, 'test'.
- Set the URL prefix to the URL prefix of the remote resources including username and password: https://<username>:<password>@<url_prefix>
This will mask the username and password from being in the URL, so the resulting Cloudinary URL will be:
https://res.cloudinary.com/<cloudname>/image/fetch/test/<url_postfix>
More information on auto upload mapping can be found here: https://cloudinary.com/documentation/fetch_remote_images#auto_upload_remote_resources
Comments
0 comments
Please sign in to leave a comment.