pinterest / api-quickstart

Code that makes it easy to get started with the Pinterest API.
Apache License 2.0
125 stars 46 forks source link

Pinterest API is always asking for permissions #28

Closed epsilongithub closed 3 years ago

epsilongithub commented 3 years ago

I am using the NodeJS version of the API, and everytime I execute a script, for example get_analytics.js, I am redirected to developers.pinterest.com and have to give permission. I have my APP_ID and API_SECRET configured and env | grep PINTEREST_APP returns them correctly. Why is this happening?

davidchaiken commented 3 years ago

Thanks for your interest in the Pinterest API!

The application credentials (APP_ID and APP_SECRET) allow the code to execute the OAuth 2.0 flow. Then, each user (including you) needs to go through the OAuth process. The application then needs to take an additional step to save each user's authorization token for future use. A simple version of saving the authorization token is available with the --write option for the get_access_token script. For example, if you run these commands, you should only have to go through the OAuth redirect process once:

  ./scripts/get_access_token.js --write --scopes READ_USERS,READ_PINS,READ_BOARDS
  ./scripts/get_user_pins.js
  ./scripts/get_user_boards.js

This functionality is described in the OAuth 2.0 Authorization section of the top-level README for this repo. I'd appreciate some feedback on how to make the process more clear.

davidchaiken commented 3 years ago

Hi, @epsilongithub.

I'm wondering if the reply to your question helped? We're thinking about ways to make the tutorial better, and any feedback that you can share with us would be really helpful.

Thanks!

davidchaiken commented 3 years ago

Hi, @epsilongithub. I'm closing this issue, but please feel free to reach out with additional questions and/or feedback for us.