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" : "d09389f9d493dd90ee4b316272e87d233856254afd468537e3d650025f1fd780",
  "client_secret" : "784028ecd950fa4354a6f2be54f1c64b15e6781271d7444b10aa0e95ee145d33",
  "redirect_uri" : "http://example.org/",
  "code" : "66836e3b45e04c7afaa24af24011ce6e9e57cbce1e2d39a064d1891a48b850f8",
  "grant_type" : "authorization_code"
}

Response

Status

200 OK

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Cache-Control: no-store
Pragma: no-cache
Content-Type: application/json; charset=utf-8
ETag: W/"857775021dda57522e107dd6448e4110"
Content-Length: 105

Body

{
  "access_token" : "effd0f1941771b7795bb8870d9cdda53ce590a1d955d4d2c49b91c93581ef02e",
  "token_type" : "bearer"
}