producthunt / producthunt-api

Product Hunt API
302 stars 31 forks source link

Welcome to Product Hunt API 2.0 Starter Kit

This is a minimal starter kit that integrates with Product Hunt's API V2 via OAuth flow.

Dependencies

Setup

  1. Create an OAuth application via API Dashboard

  2. git clone git@github.com:producthunt/producthunt-api.git

  3. yarn or npm install

  4. cp .env.sample .env.

  5. Update PH_APP_API_KEY & PH_APP_API_SECRET, PH_APP_REDIRECT_URI & PH_APP_REQUESTED_SCOPES values in .env file.

  6. Only needed for local development: Generate self-signed certificate to run app on https locally. openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.cert

  7. yarn build - creates a production ready build of the React app.

  8. yarn start - starts the application server on port 3000.

  9. open https://localhost:3000.

Development

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"client_id":"YOUR_API_KEY_HERE","client_secret":"YOUR_API_SECRET_HERE", "grant_type": "client_credentials"}' \
  https://api.producthunt.com/v2/oauth/token

API

The API supports 3 scopes as of now:

public - Allows to access public information on Product Hunt.

private - Allows to access Product Hunt on behalf of the authenticated user. e.g Read goals of the user.

write - Allows to write data to Product Hunt on behalf of the authenticated user. e.g Mark goals of user as complete/incomplete.

Useful Links:

For feedback, requests and bugs please visit: https://github.com/producthunt/producthunt-api/issues

Happy Hacking!