title: HTTP POST request to JIRA from Angular 4 project throwing ERROR 403
body: <p>I am trying to execute an HTTP POST request to create a JIRA Issue ticket using Angular4. </p>
  
  <p>Following is the snippet of code I'm using:</p>
  
  <pre><code>const username = 'username';
  const password = 'password';
  const params = '{' +
                    '"fields":{' +
                        '"project": {' +
                              '"key": "ABCD" },' +
                          '"summary": "' + this.form.value.summary + '",' +
                          '"description":"' + this.form.value.description + '",' +
                          '"issuetype": {' +
                            '"name" : "' + this.form.value.issuetype + '"},' +
                          '"customfield_10041": {"value": "' + this.form.value.storyType + '"}' +
                        '}' +
                    '}' ; 
  
  const headers = new Headers();
  headers.append('Host', 'https://jira-uat.in.here.com');
  headers.append('Content-Type', 'application/json');
  headers.append('Authorization', 'Basic ' + btoa(username + ':' + password));
  
  return this.http.post('https://someURI/rest/api/2/issue/', params , {headers: headers}).map(res =&gt; res.json());
  </code></pre>
  
  <p>Although I am able to successfully create a JIRA issue using POSTMAN (an HTTP client for testing web services), but when I try to run through my Angular project, it throws me the following error: </p>
  
  <pre><code> ERROR: Response with status: 403 Forbidden for URL: https://someURI/rest/api/2/issue/
  </code></pre>
  
  <p>Any clue as to what am I missing out here?</p>
  
  <p>When I try to compile the code, following are the REQUEST HEADERS that is passed - </p>
  
  <pre><code> Accept:application/json, text/plain, */*
   Accept-Encoding:gzip, deflate, br
   Accept-Language:en-US,en;q=0.8
   Authorization:Basic Z**********************h
   Connection:keep-alive
   Content-Length:149
   Content-Type:application/json
   Host:someURI
   Origin:http://evil.com/
   Referer:http://localhost:4200/someRoute
   User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 
   (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
  </code></pre>
  
  <p>And following is are the RESPONSE HEADERS:</p>
  
  <pre><code>Cache-Control:no-cache, no-store, no-transform
  Connection:Keep-Alive
  Content-Type:text/html;charset=UTF-8
  Date:Tue, 01 Aug 2017 17:35:41 GMT
  Keep-Alive:timeout=5, max=99
  Server:Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_jk/1.2.41
  Set-Cookie:JIRA72ARD1SESSIONID=E558106054FA151216527F0A66C6D204; Path=/; Secure; HttpOnly
  Set-Cookie:atlassian.xsrf.token=BO4R-SWLP-WXR5-89O4|b25695ca2bee6fbaa48e9cddcf023d851bfc5bf5|lin; Path=/; Secure
  Transfer-Encoding:chunked
  X-AREQUESTID:1055x68000x1
  X-ASEN:SEN-2026451
  X-ASESSIONID:c993lp
  X-AUSERNAME:username
  X-Content-Type-Options:nosniff
  X-Seraph-LoginReason:OK
  </code></pre>
  
  <p>Not sure what is wrong in this that's causing the problem!</p>