Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the auth code endpoint in Pinterest?

This documentation is clear: http://developers.pinterest.com/api_docs/oauth_code_exchange/

I need the code for swap it with an access token. But where is the endpoint for access to this code? Tried the "classic" :

https://api.pinterest.com/oauth2/auth?client_id=&redirect_uri=&scope=&response_type=code

but seems 404.

like image 890
markzzz Avatar asked Feb 07 '14 10:02

markzzz


People also ask

What is authorization endpoint?

The /oauth2/authorize endpoint is a redirection endpoint that supports two redirect destinations. If you include an identity_provider or idp_identifier parameter in the URL, it silently redirects your user to the sign-in page for that identity provider (IdP).

How do I get a Pinterest access token?

In order for you to get an Access Token now you will need to be the owner or have the owner of the Pinterest feed you want to show, click the button on the Pinterest Options page of our plugin to get there Access Token. Most importantly, click the Save all changes button at the bottom of the page to save the token.

What is Server Auth Code?

The authorization code is a temporary code that the client will exchange for an access token. The code itself is obtained from the authorization server where the user gets a chance to see what the information the client is requesting, and approve or deny the request.

What is a Auth URL?

The auth-url command specifies the URL to the endpoint that authenticates user credentials. User credentials in the authorization header are validated by the endpoint that is specified in the URL. When the user is authenticated, DataPower® expects the authentication URL to return an HTTP 200 OK response status code.


1 Answers

The endpoint for v3 is:

PUT https://api.pinterest.com/v3/oauth/code_exchange/

Example:

curl -X PUT https://api.pinterest.com/v3/oauth/code_exchange/ -d "access_token={access token}&consumer_id={client id}&consumer_secret={client secret}&redirect_uri={redirect uri}&code={code}&grant_type=authorization_code"

What is strange though, is that you have to pass in a valid access token for the endpoint to work or it will return an Unauthenticated error. The access token can be from anyone or any Pinterest app and does not need to be from the authenticating user or the authenticating app, as long as it has not expired.

The easiest way to obtain a valid access token as of now is to log in to the Pinterest for iPhone app here and you will find the token in the URL hash:

https://www.pinterest.com/oauth/?consumer_id=1431594&response_type=token

like image 104
Ben Wong Avatar answered Oct 08 '22 18:10

Ben Wong