Pinterest API giving Error code 3

2019-03-02 07:50发布

问题:

I am hitting Pinterest's /v1/me/boards API, but i am getting following response:

{"status": "failure", "code": 3, "host": "devplatform-devapi-prod-d4f1472d", "generated_at": "Tue, 05 Jan 2016 13:29:40 +0000", "message": "Authorization failed.", "data": null}

I am making following request

{
  "method": "get",
  "url": "https://api.pinterest.com/v1/me/boards",
  "headers": {
    "Authorization": "Bearer <valid-token-value-here>"
  },
  "qs": {
    "fields": "image,counts,created_at,description,url,name"
  }
}

I am passing above configuration to the request module.

Note: <valid-token-value-here> actually gets replaced by token while passing the configuration.

Can anyone suggest me what wrong i am doing here ?

回答1:

Finally, it turned out to be a silly mistake.

I was passing scope=undefined at time of authorization. After providing correct scope, APIs are working as expected.

@Zack Argyle Although not passing valid scope is client side issue, but i still feel, Pinterest should refuse the authorization in such cases.