-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
I want to use the API to fetch data from creators I support on Patreon with my own account. I created a client and found my creator access token.
import patreon,json
client_id = " " # My client ID
client_secret = " " # My client secret
oauth_client = patreon.OAuth(client_id, client_secret)
tokens = {}
with open('patreontokens', 'r') as tfile: # Creator access and refresh tokens stored in a file
tokens = json.loads(tfile.read())
tokens = oauth_client.refresh_token(tokens["refresh_token"]) # Refresh the tokens
with open('patreontokens', 'w') as tfile:
tfile.write(json.dumps(tokens))
creator_access_token=tokens["access_token"]
api_client = patreon.API(access_token)
ident = api_client.get_identity()
print(ident)I read about a similar issue here which is why I am refreshing the token.
The output of the program is:
{'errors': [{'code': 1, 'code_name': 'Unauthorized', 'detail': "The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.", 'id': 'ca7835a3-90f2-4d1e-aa99-188a9efc5285', 'status': '401', 'title': 'Unauthorized'}]}I have confirmed by doing print(token) that the refreshed token matches the one given to me at https://www.patreon.com/portal/registration/register-clients
Metadata
Metadata
Assignees
Labels
No labels