OAuth POST fails with oauth_problem=signature_invalid but GET passes Edited

I am facing an issue in my Node Application. While making a POST request to create Issue endpoint, it always fails with oauth_problem=signature_invalid.

But when I make a GET request to other endpoints, it works.

My code:

const fs = require('fs');
const OAuth = require('oauth').OAuth;
const config = require('./config');
var payload = {// ... };

const consumer = new OAuth(
    `${config.baseUrl}/plugins/servlet/oauth/request-token`,
    `${config.baseUrl}/plugins/servlet/oauth/access-token`,
    config.consumerKey,
    fs.readFileSync('./keys/jira_privatekey.pem', 'utf8'),
    "1.0",
    "http://example.com",
    "RSA-SHA1");

consumer.post(`${config.baseUrl}/rest/api/2/issue/`, config.accesToken, config.tokenSecret, payload, (e, data, resp) => {
    console.log(e);
    console.log(data);
});

 

I double checked the URLs, and all of them are correct.

Error:

oauth_problem=signature_invalid

1 answer

0 vote
Gonchik Tsymzhitov Community Champion Oct 06, 2017

Hi! 

Please, have a look this knowledge base:

https://confluence.atlassian.com/kb/oauth-error-oauth_problem-signature_invalid-720406720.html

 

Cheers, 

Gonchik Tsymzhitov

Hi,

Please correct me if I am wrong:

Base URL is where my JIRA is hosted. eg: dev.domain.org.com

Following this tutorial, I have set my Application URL to http://example.com

As you can see above in code, I have passed as http://example.com.

 

Am I still missing something? This is a console application, its not behind firewall or nginx proxy.

But my node is not hosted anywhere, its a console application. How will I get the node app link?

 

I generated access token using this guide

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,331 views 14 20
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot