为什么COR会在我的Angular项目中阻止我的授权标题?
因此,当我尝试与Slack API进行连接时。 ,以及访问控制的头 - 所有这些都带有相同的错误,而是说下面的标头的名称是我的代码。
const headers = new HttpHeaders({
'Content-Type': "application/x-www-form-urlencoded",
'Authorization': "Bearer <access-token>"
})
const body= "?channel=C03G3MG1KPE"
return this.http.get<any>(this.getURL+body,{ headers: headers });
我也使用Angular:8.2.12如果该上下文有帮助
So when I try to do a connection to the slack Api "https://slack.com/api/conversations.history" and add Authorization as a header I get back this error Error picture I've tried using the headers Access-Control-Allow-Credential,Access-Control-Allow-Methods,Access-Control-Allow-origin, and Access-Control-Allow-header all of which came back with the same error from above but instead says that name of that header below is my code.
const headers = new HttpHeaders({
'Content-Type': "application/x-www-form-urlencoded",
'Authorization': "Bearer <access-token>"
})
const body= "?channel=C03G3MG1KPE"
return this.http.get<any>(this.getURL+body,{ headers: headers });
I'm also using Angular: 8.2.12 if that context helps
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,所以我能够将其切换到帖子,然后添加帖子正文中的身份令牌,有点奇怪,但是如果它有效,我猜它有效。
ok so I was able to switch it to a post then add in the auth token in via body of the post, kinda weird but if it works it works i guess.