我正在尝试按照正常的oauth2程序创建一个Pinterest应用程序。但是我一直收到一个无效的访问令牌。
在授权应用后,请注意重定向网址中的参数“expires_at = 2592000”:
https://www.pinterest.com/oauth/?consumer_id=1438601&response_type=token
我也尝试过:
https://www.pinterest.com/oauth/?consumer_id=1438601&response_type=code
并交换从上面收到的代码以获取访问令牌:
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"
返回:
{
"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"
}
}
令牌再次在2592000(1970年的某个时间)到期。
我在Pinterest for iPhone应用程序中尝试了同样的事情,它返回了一个有效的令牌:
https://www.pinterest.com/oauth/?consumer_id=1431594&response_type=token
任何帮助将不胜感激。感谢。