【问题标题】:Pinterest API Access token expirePinterest API 访问令牌过期
【发布时间】:2016-09-17 22:17:58
【问题描述】:

我的问题是 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 的。

对此有什么帮助吗?

【问题讨论】:

    标签: api oauth-2.0 pinterest


    【解决方案1】:

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

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

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

    【讨论】:

    • 谢谢,我不知道我是如何在文档中错过了这一点。是的,Twitter 令牌也不会过期
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多