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/v2/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
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 go with `public private write` |
Request
Route
GET /v2/oauth/authorize?client_id=6b470306b04d50cdd028b5c6922f84d91ff0c3e617c8164ae0e04b03d6ebd655&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/"73554857d650d89173a132a30b356691" Cache-Control: max-age=0, private, must-revalidate Content-Length: 2326