Having trouble authenticating a post to upload an image to the file manager
I have a serverless function to upload an image to the file manager, but am currently getting a 401 error (the call is not properly authenticated).
I have it set up almost identically to a serverless function that pulls form submission data (which is working) and I've properly registered the secret and the function file (this is the same secret used for the form data pull, which has both forms and files scopes) so I'm not sure what I need to change about the authentication in order for HubSpot to accept it.
Here's my serverless function code for the file upload (not working, 401 error):
I don't have the solution, but I have two questions for you:
have you tried using "Content-Type": "image/jpeg" or "image/png"(depending on the fie type you are using) instead of just "Content-Type": "image"?
have you tried logging the entire error object (console.error(e)) instead of just e.message?
Talk soon! — Jaycee
Join us on March 27th at 12 PM for the Digital Essentials Lab, an interactive session designed to redefine your digital strategy!
Engage with expert Jourdan Guyton to gain actionable insights, participate in live Q&A, and learn strategies to boost your business success. Don't miss this opportunity to connect and grow—reserve your spot today!
Did you know that the Community is available in other languages? Join regional conversations by changing your language settings !