Angular 上载到imgur时出错(格式错误的身份验证标头)

Angular 上载到imgur时出错(格式错误的身份验证标头),angular,imgur,Angular,Imgur,我正在尝试使用Imgur在angular web应用程序中上载一些图像,但不断出现“格式错误的身份验证头”,有人知道如何修复此错误吗 async uploadImage(imageFile:File,infoObject:{},categoryId){ const formData=new formData(); formData.append('image',imageFile,imageFile.name); const header=新的HttpHeaders(`Authorizatio

我正在尝试使用Imgur在angular web应用程序中上载一些图像,但不断出现“格式错误的身份验证头”,有人知道如何修复此错误吗

async uploadImage(imageFile:File,infoObject:{},categoryId){
const formData=new formData();
formData.append('image',imageFile,imageFile.name);
const header=新的HttpHeaders(`Authorization:Client ID xxxxxxxxxx`);
const imageData=wait this.http.post(this.url,formData,{headers:header}).toPromise();
this.imageLink=imageData['data'].link;
常量newImageObject:ImageInfo={
标题:infoObject['title'],
description:infoObject['description'],
链接:this.imageLink
};
this.images.unshift(newImageObject);
this.updateCategoryImgIconPath(categoryId,this.imageLink).subscribe(数据=>window.location.reload());
}
在Angular中设置HttpHeader的方法如下:

const header=new HttpHeaders().set('Authorization','Client ID xxxxxxxxxx');