API V1 is deprecated, Check out new API V2 here

OAuth User Authentication

oauth#token - Use the access grant code you received through the redirect to request an access token

  • Post the access_grant token (from oauth#authorize) together with several other paramers as described below.
  • Receive your access_token in the json response

Parameters

Name Description
client_id required The id of your application
client_secret required The secret of your application
redirect_uri required Where shall we redirect the client afterwards to?
grant_type required use `authorization_code`
code required The access grant code you received via the callback from the previous step

Request

Route

POST /v1/oauth/token

Headers

Accept: application/json
Content-Type: application/json
Host: api.producthunt.com

Body

{
  "client_id": "_-Vg4Sb3hI4Iz36XrUTKwJrW4_BYa1DGK9GJw-XxfZw",
  "client_secret": "cqWaItjjv_LzfcFysPq2o8gBfe8eJ9in8aNg-EpmqAk",
  "redirect_uri": "https://example.com/callback",
  "code": "2Ob2DuVi-9oD1fRt1pHJaV5gYMYa7xyDz58dEr1yKmE",
  "grant_type": "authorization_code"
}

Response

Status

200 OK

Headers

Cache-Control: no-store
Pragma: no-cache
Content-Type: application/json; charset=utf-8
ETag: W/"1d9974af8f3b96599cd0fcf74e7951cc"
Content-Length: 108

Body

{
  "access_token": "Jin15vOMP9-A_M3O_vwoeUkSVhJfuIKzYmfwIuAPb7U",
  "token_type": "Bearer",
  "created_at": 1620214744
}