Pinterest API returns expired token?

2019-06-10 00:15发布

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.

0条回答
登录 后发表回答