vuestorefront / mage2vuestorefront

Magento to Vue-storefront datapump - synchronizes Products, Categories and Product-to-category links between your Magento2 API and NoSQL database of vue-storefront

Home Page:http://vuestorefront.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error: API call failed: Invalid signature

zadigus opened this issue · comments

Hi,
I followed the advice you give here:
https://medium.com/@piotrkarwatka/vue-storefront-how-to-install-and-integrate-with-magento2-227767dd65b2
And now I am trying to integrate Magento2 with my local vue-storefront instance, i.e. I am trying to execute
node cli.js taxrule
It fails with the following feedback:

info: Winston logging library initialized.
2018-08-22T04:27:38.631Z - info: Connected correctly to server
2018-08-22T04:27:38.631Z - info: TRANSACTION KEY = 1534912058615
debug: Calling API endpoint: GET http://local.magento/rest/V1/taxRules/search?searchCriteria=undefined
debug: Response received.
error: API call failed: Invalid signature
2018-08-22T04:27:38.936Z - error: Invalid signature
2018-08-22T04:27:38.936Z - info: Task done! Exiting in 30s ...
2018-08-22T04:27:38.936Z - error: No items given to processItems call!

It is a bit strange, because if I browse http://local.magento/rest/V1/taxRules/search?searchCriteria=undefined then I get

<response>
  <message>Consumer is not authorized to access %resources</message>
    <parameters><resources>Magento_Tax::manage_tax</resources></parameters></response>

which is fine. The endpoint is indeed reachable and there is no signature problem. Would I set the correct authorization header (which is done in your cli.js), I would get the data. How can I make your cli.js access that REST resource without getting the above invalid signature error?

I was able to find out what my problem was. I defined the environment variable MAGENTO_TOKEN_SECRET instead of MAGENTO_ACCESS_TOKEN_SECRET. This has the implication that the latter was not defined. Therefore the signature was invalid. Sorry to have bothered you with this stupid mistake.

I found the solution thanks to your test scripts.

Cool, what was it?

Exactly what I wrote in the last message before closing the topic. I misspelled the environment variable's name.

I was able to find out what my problem was. I defined the environment variable MAGENTO_TOKEN_SECRET instead of MAGENTO_ACCESS_TOKEN_SECRET. This has the implication that the latter was not defined. Therefore the signature was invalid. Sorry to have bothered you with this stupid mistake.

How to do this? i have a similar issue with you @zadigus

oh it's been a while since that message. As I haven't continued following vue-storefront's progress, it's difficult to me to say if that's still relevant ! but in my case it was just a variable misspelling.