Skip to content

Commit 2443c54

Browse files
MerleLiuKunpennersr
authored andcommittedDec 28, 2022
fix(pinterest): 🐛 make v3 get user info work well, and update the docs
1 parent 27f7f1c commit 2443c54

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed
 

‎allauth/socialaccount/providers/pinterest/views.py

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ class PinterestOAuth2Adapter(OAuth2Adapter):
3232
profile_url = "https://{0}/{1}/user_account".format(
3333
provider_base_url, provider_api_version
3434
)
35+
elif provider_api_version == "v3":
36+
profile_url = "https://{0}/{1}/users/me".format(
37+
provider_base_url, provider_api_version
38+
)
3539
else:
3640
profile_url = "https://{0}/{1}/me".format(
3741
provider_base_url, provider_api_version

‎docs/providers.rst

+18-5
Original file line numberDiff line numberDiff line change
@@ -1689,26 +1689,39 @@ Pinterest
16891689

16901690
The Pinterest OAuth2 documentation:
16911691

1692+
# v1 # has been deprecated
16921693
https://developers.pinterest.com/docs/api/overview/#authentication
16931694

1695+
# v3 # plan to enforce an end of life on June 30, 2023.
1696+
https://developers.pinterest.com/docs/redoc/#section/User-Authorization
1697+
1698+
# v5
1699+
https://developers.pinterest.com/docs/getting-started/authentication/
1700+
16941701
You can optionally specify additional permissions to use. If no ``SCOPE``
1695-
value is set, the Pinterest provider will use ``read_public`` by default.
1702+
value is set, the Pinterest provider will use reading scope by default.
16961703

16971704
.. code-block:: python
16981705
16991706
SOCIALACCOUNT_PROVIDERS = {
17001707
'pinterest': {
1701-
'SCOPE': [
1702-
'read_public',
1703-
'read_relationships',
1704-
]
1708+
'SCOPE': ['user_accounts:read'],
1709+
"PINTEREST_VERSION": "v5",
17051710
}
17061711
}
17071712
17081713
SCOPE:
17091714
For a full list of scope options, see
1715+
1716+
# v1
17101717
https://developers.pinterest.com/docs/api/overview/#scopes
17111718

1719+
# v3
1720+
https://developers.pinterest.com/docs/redoc/#section/User-Authorization/OAuth-scopes
1721+
1722+
# v5
1723+
https://developers.pinterest.com/docs/getting-started/scopes/
1724+
17121725
Pocket
17131726
-------------
17141727

0 commit comments

Comments
 (0)
Please sign in to comment.