0

I'm trying to create a Pinterest application following the normal oauth2 procedures. However I keep receiving an invalid access token.

Note the parameter "expires_at=2592000" in the redirect URL after authorizing the app:

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

I also tried:

https://www.pinterest.com/oauth/?consumer_id=1438601&response_type=code

And exchanging the code received from above for an access token:

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

returns:

{
"status": "success", "code": 0, "host": "ngapi2-a41ad0f6", 
"generated_at": "Fri, 20 Jun 2014 06:59:57 +0000", "message": "ok", 
"data": {
"access_token": "MTQzODYwMTo1Mzk1MTczNjc3Njg1OTMxMTc6MTY0Mjh8MTQwMzI0NzU5NzoyNTkyMDAwLS1iYzQzYWViOGIwZjZlY2UwZDQ4ZmMyYWQ0NjU1ZDliZQ==", 
"expires_at": 2592000, 
"consumer_id": 1438601, 
"token_type": "bearer", 
"authorized": true,
"scope": "bulk_pins,create_boards,create_pins,get_boards"
        }
}

Again the token expired at 2592000 (some time in 1970).

I've tried the same thing with the Pinterest for iPhone app and it returns a valid token:

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

Any help would be appreciated. Thanks.

Ben Wong
  • 1,987
  • 2
  • 19
  • 20
  • I suspect that 2592000 value is the duration for which the token is valid and not the unix timestamp that you are referring to (I think). It translates to a 30 day period which is pretty reasonable. – anfab Jun 21 '14 at 14:24
  • This does not seem to be the case. The token is not valid when I make any API calls even immediately after I receive the token. – Ben Wong Jun 23 '14 at 21:57
  • @BenWong I am having the same issue. And now I see that your test app request https://www.pinterest.com/oauth/?consumer_id=1438601&response_type=code is working while when I use my application code the server returns an error. How did you resolve your issue? – Michael Shmalko Sep 20 '14 at 05:38
  • 1
    @MichaelSh It appears that Pinterest returns an expired token if your app has not been approved by them. Try submitting your app to Pinterest for approval, or see http://stackoverflow.com/questions/9951045/pinterest-api-documentation/24335000#24335000 for a workaround. – Ben Wong Sep 21 '14 at 17:05

0 Answers0