Issue
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
Solution
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.
const header = new HttpHeaders({
'Content-Type': "application/x-www-form-urlencoded"
})
const options = {
headers: header
}
const body="token=<Token Here>"
const path= "?channel="+channel
return this.http.post<any>(this.getURL+path,body,options);
Answered By - Robert Shaw
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.