Cloudinary supports uploading images directly from an HTTP address or via the API code.
There may be cases when you would need authorization in order to access the image that you want to upload to your Cloudinary account.
In order to access an HTTP address which requires authorization, you can add the `Authorization` header, containing the credentials, to the upload request. For example, you can use something like the below parameter to the call:
headers="Authorization: <access token>"
Example of the upload call in Node.JS is as shown below:
const options = {
headers: ["Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l"],
};
cloudinary.uploader.upload("https://example.com/image.jpg", options, (err, res) => { console.log(err, res)};
For more information about the 'headers' parameter, please see:
https://cloudinary.com/documentation/image_upload_api_reference#upload_method
Comments
0 comments
Please sign in to leave a comment.