Valid BigCommerce auth token triggers 'Authorization Error' getting webhooks?

让人想犯罪 __ 提交于 2019-12-08 04:57:23

问题


I've gone through the two step oAuth process to get a long lived access token. I can validate that the access token is valid by successfully making several API calls with cURL...

curl -XGET 
  -H 'X-Auth-Client: xxxxxxxxxxxxxxxxxxx'
  -H 'X-Auth-Token: xxxxxxxxxxxxxxxxxxx'   
https://api.bigcommerce.com/stores/xxxxx/v2/products

...returns the store products as expected. Provisioning webhooks returns results as expected. However requesting the list of webhooks:

curl -XGET 
  -H 'X-Auth-Client: xxxxxxxxxxxxxxxxxxx'
  -H 'X-Auth-Token: xxxxxxxxxxxxxxxxxxx'   
https://api.bigcommerce.com/stores/xxxxx/v2/hooks

Yields {"error":"Authorization Error."}

The token is for the store owner. The store owner has all visible permissions enabled in the admin interface, and as stated above has the ability to provision new webhooks.

Is there a separate permissions somewhere to enable listing webhooks? Is the BigCommerce API just buggy?


回答1:


The Authorization Error. is a misleading error message. The problem is actually just that I needed to explicitly set the accept header on the curl request:

curl -XGET 
  -H 'X-Auth-Client: xxxxxxxxxxxxxxxxxxx'
  -H 'X-Auth-Token: xxxxxxxxxxxxxxxxxxx'   
  -H 'Accept: application/json'
https://api.bigcommerce.com/stores/xxxxx/v2/hooks

Yields the expected results.



来源:https://stackoverflow.com/questions/25170326/valid-bigcommerce-auth-token-triggers-authorization-error-getting-webhooks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!