Resolving Cloudinary 401 Unauthorized Error for PDF Viewing
Recently, I encountered a problem while attempting to view PDFs uploaded to Cloudinary – the dreaded 401 Unauthorized error. Frustratingly vague, the error message left me on a quest for answers. If you've found yourself in a similar predicament, here's a straightforward guide on resolving it.
Cloudinary is a cloud-based image and video management service that provides solutions for efficiently storing, managing, and delivering digital assets. I have been hearing alot about Cloudinary, and decided to try it out for a project I am working on.
401 Unauthorized Error
I was able to upload assets to Cloudinary, but I couldn't view those assets, even when I log in to my Cloudinary account and try to use the media explorer or media library provided by Cloudinary on the dashboard. When I check the browser console, I would see an HTTP 401 error. HTTP status code 401 indicates that the request lacks valid authentication credentials, but this was not the case. On investigating the issue further, by checking the response headers, the
X-Cld-Error header read "deny or ACL failure". We can both agree that this error message is no where helpful. Even on pasting that error message into a search engine, the articles you will find by Cloudinary, provides no viable solution to this particular problem.
For some reason, Cloudinary throws a HTTP 401 error for PDF & ZIP files, because of security concerns. Read more here.
1. Navigate to Settings:
Log in to your Cloudinary account and access the settings section, which essentially serves as the control panel for your Cloudinary configurations.
Read also : Cyber security 101 : Basics.
2. Security Section:
Inside the settings, locate the Security tab – your digital fortress protecting your assets from unauthorized access.
3. PDF and ZIP Files Delivery:
Within the Security section, find the option dedicated to PDF and ZIP files delivery. This is where the root of the problem lies.
4. Tick "Allow delivery of PDF and ZIP files":
The key lies in this simple toggle. By selecting "Allow delivery of PDF and ZIP files," you inform Cloudinary that these file types are safe for delivery. Do not forget to click the "Save" button at the bottom of the security page, to effect changes.
In essence, the 401 Unauthorized error often stems from a security setting that restricts the delivery of PDF and ZIP files. By adjusting this setting, you enable a smooth viewing experience for your uploaded PDFs. I hope this concise guide assists you in swiftly resolving the issue.