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.
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).
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With