When I use https://www.patreon.com/api/campaigns/9301487/posts I only get the ‘free’ posts. What api call is needed to get all the ‘unlocked’ posts for a logged in user?
I tried the v2 api: https://www.patreon.com/api/oauth2/v2/campaigns/9301487/posts, but that return an empty array.
You must have a token with campaigns.posts that was authorized by the campaign’s owner.
Thank you for you answer. How does the owner authorise this?
You must get the user go through an oauth2 authorization flow and ask the campaigns.posts scope in the process. Then you store the resulting token to use it for calling the posts endpoint.
https://docs.patreon.com/#oauth
The PHP library has easy to read and impleemnt examples of this.
Ok, I missed the campaign.posts scope. Thanks
But I only see the posts for my Own campaign. When I use a pledged user the posts are empty.
Is it possible for a loged in pledged user to see the posts of my campaign via the api?
If im understanding correctly:
You cant pull and show your own posts by using a user’s token. The user’s campaign scoped token will only give access to that user’s campaign.
If you want to show your posts via the api, what you must do is to sync your posts to your local site/app via the api using your own creator access token, then display the posts to your user however you want.
To do that, you can get the user authenticated into your site via Patreon and check the user’s membership to your campaign and then release the post if the membership is valid.