OAuth User Authentication

oauth#authorize - Ask for access grant code on behalf of the user

  • You need to redirect your users to this endpoint
    https://api.producthunt.com/v1/oauth/authorize?client_id=[clientid]&redirect_uri=[where shall we redirect to?]&response_type=code&scope=public+private
  • Once they logged into producthunt and gave your app permission we send them back to [redirect_uri] together with an access_grant token as code parameter.
  • Use this access_grant in the oauth#token step
Important: To write on behalf of the user you need to get your app approved by us. Additionally you need to make sure you require `public` and `private` scopes.

Parameters

Name Description
client_id required The id of your application
redirect_uri required Where shall we redirect the client afterwards to?
response_type required The parameter name of the request token that will be passed to your site, in case of doubt use `code`
scope required If you only require public information you want to use `public`. If you need private information of the logged-in user go with `public private`. If you have write access and want to update user information you also need `public private`

Request

Route

GET /v1/oauth/authorize?client_id=bb63e1f73a23bae525458ef52e1f344546f6c7737886b839997ddab923180659&redirect_uri=http%3A%2F%2Fexample.org%2F&response_type=code&scope=public+private

Headers

Host: api.producthunt.com

Response

Status

200 OK

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=utf-8
ETag: W/"03af6f2d3aa4bd7b42f9ae647c93fc28"
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 2326