I'm attempting to utilize a GitHub OAuth Token for posting comments in Angular 2. Below is the code I am using:
postComment(token: string, number: Number, body: string): Promise<Comment> {
let headers = new Headers()
headers.append('Authorization', `token ${token}`)
return this.http
.post(`https://api.github.com/repos/${this.GITHUB_USERNAME}/${this.GITHUB_POST_REPO}/issues/${number}/comments`, {body}, {
headers: headers
}).toPromise()
.then(res => res.json() as Comment)
}
Unfortunately, it's not functioning as expected and I always receive this response:
{
"message": "Issue not viewable by PoiScript",
"documentation_url": "https://developer.github.com/v3"
}
Additionally, please note that I am trying to post comments on issues rather than pull requests or commits.