I'm currently in the process of developing a web application using Angular, and I'm encountering difficulties with the Imgur API integration. My main objective is to create a form where users can select their photos, which will then be uploaded to Imgur with the link to the stored image being saved.
However, I've run into two issues: What is the most effective method for "storing" the image? Currently, I'm using the "change" property and saving it like this:
this.file = event.srcElement.files
Is this the correct approach?
Furthermore, I'm facing challenges when attempting to send the image to the API.
var headers = {'Authorization': 'Client-ID {{id-here}}'};
this.http.post(url, payload, headers)
.toPromise()
.then(response => {
console.log(response);
response.json() as string;
})
.catch(this.handleError);
The server is returning a 401 - unauthorized error. It seems like I might be loading the client ID incorrectly, but I'm unsure of the correct method.
Similarly, I'm unsure about how to declare the payload. Any guidance on this would be greatly appreciated.
Thank you for your assistance!