Pinterest API访问令牌过期

时间:2016-05-20 15:23:03

标签: api oauth-2.0 pinterest

我的问题是Pinterest访问令牌到期了吗?

我在Pinterest官方文档后获取访问令牌:

获取授权码:

https://developers.pinterest.com/docs/api/overview/#getting-your-authorization-code

https://api.pinterest.com/oauth/?
    response_type=code&
    redirect_uri=https://mywebsite.com/connect/pinterest/&
    client_id=12345&
    scope=read_public,write_public&
    state=768uyFys

获取访问令牌:

https://developers.pinterest.com/docs/api/overview/#getting-your-access-token

https://api.pinterest.com/v1/oauth/token?
    grant_type=authorization_code&
    client_id=12345&
    client_secret=6789abcd&
    code=xyz1010

实际回应是:

{
    "access_token": "AfISUq75NELGEECEurmvEcIwlQZDFFBOnAdsa", 
    "token_type": "bearer", 
    "scope": [
        "read_public", 
        "write_public", 
        "read_private", 
        "write_private", 
        "read_write_all"
        ]
}

我无法在Pinterest文档中找到有关令牌过期的任何内容,并且不会在响应中返回到期日期。

根据这个问题Pinterest returns expired token

我可以看到这个人正在使用API​​ v3端点: https://api.pinterest.com/v3/oauth/code_exchange/

作为回应,他正在获得expires_at字段

在pinterest文档中,我找不到任何关于API versinos V2或V3的内容,

所有文档Pinterest API都与API V1有关。

对此有何帮助?

1 个答案:

答案 0 :(得分:5)

Pinterest访问令牌似乎没有到期日期,至少在当前版本的API中是这样。来自documentation

  

交换访问令牌。您的应用会调用API来交换访问令牌的授权码,这是永久凭据(除非用户撤消您的访问权限)。您将使用访问令牌代表您的用户在Pinterest上执行操作。

我碰巧知道Stack Overflow OAuth令牌也没有到期日期,以防您想知道其他主要网站是否使用此工作流程。

相关问题