Pinterest API访问令牌过期

5

我的问题是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版本V2或V3的内容,

所有他们的文档 Pinterest API 都是关于API V1的。

有关此事的任何帮助?

1个回答

7

根据当前版本的API,Pinterest访问令牌似乎没有到期日期。来自文档:

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

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


谢谢,我不知道为什么在文档中错过了这个。是的,Twitter令牌也不会过期。 - carpics

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接