JIRA 보드 용 D3 시각화 프로젝트를 개발하려고하지만 첫 번째 장애물에 빠졌습니다. 인증 및 JIRA 보드 목록을 가져 오는 데 문제가 있습니다.JIRA REST API를 쿼리하는 이상한 CORS 오류
이 코드 내 서비스는 다음과 같습니다 완전히 클라이언트 측하고 각도 2 RC 3에있다 :
public authenticate(username:string, password:string):void {
let encodedAuth:string = window.btoa(`${username}:${password}`);
this.headers = new Headers();
this.headers.append('Content-Type', 'application/json');
this.headers.append('Authorization', `Basic ${encodedAuth}`);
}
public getAllBoards():Observable<Boards> {
return this.http.get(`http://${this.host}/rest/agile/1.0/board`, this.headers)
.map(response => response.json() as Boards)
}
내 구성 요소의 코드는 다음과 같습니다
constructor(protected jiraService:JIRAService) {
this.jiraService.authenticate('[email protected]', 'password');
this.jiraService.getAllBoards().subscribe(
boards => this.boards = boards
);
}
불행하게도 , 내 브라우저에서 CORS 오류와 비슷한 모양이 생성됩니다.
XMLHttpRequest cannot load https://myjira.atlassian.net/rest/agile/1.0/board. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 401.
... 조금 어긋납니다 xpected. 이 URL은 브라우저에서 제대로 작동합니다. Charles에서 요청을 검사하면 "이 프록시는 SSL 프록시를 사용할 수 없습니다 : 프록시 설정, SSL 위치에서 활성화"라는 오류가 표시되지만 실제로이 설정을 찾을 수 없습니다. 나는 Charles에게서 그것을 실제로 볼 수 없어도 상관 없다, 나는 단지 그것을 얻고 싶다!
npm JIRA 패키지 중 몇 가지를 시도했지만 주목할만한 것은 아니며 서버 측 개발 용으로 설계된 것 같습니다.
도움을 주시면 감사하겠습니다.
웹API로 작업 할 때 서버가 500을 반환하면 CORS 오류가 발생합니다. 브라우저에서 동일한 URL이 작동 중이며 우편함과 같은 도구를 사용하여 사용자 정의 헤더를 추가 했습니까? 일반 브라우저 창? –
브라우저에서 Postman과 직접 URL을 모두 사용했습니다. – serlingpa