question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid signature error 401 REST API magento 2

See original GitHub issue

Hello. I’m trying to create a request to magento 2 REST API. I use oauth and have all tokens (consumer, consumer secret, token and token secret). I need to pass param like this: http://devdocs.magento.com/guides/v2.1/howdoi/webapi/search-criteria.html

My code:

const optionsToRequest = {
        url: `http://host/rest/V1/customers/search`,
        json: true,
        oauth: {
        consumer_key: CONSUMER_KEY,
        consumer_secret: CONSUMER_SECRET,
        token: TOKEN,
        token_secret: TOKEN_SECRET
    },
    qsStringifyOptions: {
            encode: false,
    },
    qs: { 'searchCriteria[filter_groups][0][filters][0][field]': 'email'}
};

request.get(optionsToRequest)
        .then(res => console.log(res));

and when i’m creating request then get response with error {"message":"Invalid signature"}. searchCriteria param looks like: searchCriteria[filter_groups][0][filters][0][field]=email. I also tried to create a query in POSTMAN and there everything is ok. I don’t understand this. Where is the mistake? The entire query should look like this: http://host/rest/V1/customers/search?searchCriteria[filter_groups][0][filters][0][field]=email

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mohantorrezcommented, Apr 9, 2019

Is there any fix for this issue?

0reactions
chileapcommented, Jun 11, 2019

is there anyone can fix this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid Signature - add a product using Magento REST API
i have created AccessToken and AccessTokenSecret as mentioned in the Oauth Rest API Documentation and I am able to retrieve the products ...
Read more >
Magento Rest Oauth API (Signature Invalid) 401
In my case, the local webserver runs on port 81, thus my signature and the Magento one could not match. By passing the...
Read more >
Developers - Invalid signature error 401 REST API magento 2 -
Hello. I'm trying to create a request to magento 2 REST API. I use oauth and have all tokens (consumer, consumer secret, token...
Read more >
Invalid Signature – add a product using Magento REST API
i have created AccessToken and AccessTokenSecret as mentioned in the Oauth Rest API Documentation and I am able to retrieve the products using...
Read more >
Magento 2 API returns "The signatire is invalid. Verify and try ...
A lot of time has passed since you posted this question and I don't see any answer for it. I'm running into the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found