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 /v2/oauth/token
Headers
Accept: application/json
Content-Type: application/json
Host: api.producthunt.com
Body
{
"client_id": "88e0b352f945d670875ea2d1483ac145bd3addba623053035da7db2cda4a5a90",
"client_secret": "329567d3efde1413ab754411a2d61368715365682b68b48781b381196377aacc",
"redirect_uri": "http://example.org/",
"code": "cfdc933de78e0daf84e35bb8545c0d83d5c3e2424b307164fafd17b4e2772606",
"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/"34e19c7aaf9e6a6a8df040dee817de6c"
Content-Length: 105
Body
{
"access_token": "e08bcc4a96dde0621d13f3cfea382853aa2d2ffec3f7894a28a9ed7c49857613",
"token_type": "bearer"
}