5
votes

My question is does Pinterest access token expires?

I am obtaining access token following Pinterest official documentation:

For getting authorization code:

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

And for getting access token:

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

The actual response is:

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

Nothing I can find in Pinterest documentation about token expire, and expiration date is not returned in response.

As per this question Pinterest returns expired token

i can see that this guy is using API v3 endpoint: https://api.pinterest.com/v3/oauth/code_exchange/

and in response he is getting expires_at field

In pinterest documentation I cannot find anything about API versinos V2 or V3,

all their documentation Pinterest API is about API V1.

Any help about this?

1

1 Answers

6
votes

The Pinterest access token appears to have no expiry date, at least in the current version of the API. From the documentation:

Exchange for an access token. Your app will call the API to exchange the authorization code for an access token, which is a permanent credential (unless the user revokes your access). You'll use the access token to perform actions on Pinterest on your user's behalf.

I happen to know the Stack Overflow OAuth token also has no expiry date, in case you were wondering whether any other major sites use this workflow.