Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Unathorized 401 when trying to access cloud API from AWS EC2

hardfi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 9, 2019

Hi,

I've just built a funcionality in my Node.js app that allows me to create Jira issues via Jira API. I'm using simple login with e-mail address and token + 'request' library to make requests. It works great when I launch it from in my local environment but I keep on getting 401 - Unathorized when I deploy the app to AWS EC2. What could be the reason for this issue? Below is the example request that works when fired locally:

const headers = {
'Authorization': 'Basic ' + Buffer.from(jiraUser + ':' + jiraPassword).toString('base64'),
'X-Atlassian-Token': 'no-check',
'Content-Type': 'application/json',
};
router.get('/jira/priority', AuthGuard.verify, (req, res, next) => {
request.get({url: jiraUrl + 'priority', headers: headers}, (err, resp) => {
// logic
});
});

 

The only thing that comes to my mind is the request origin, that might be different when firing requests from AWS. 

Thanks.  

0 answers

Suggest an answer

Log in or Sign up to answer