I’m developing a static site and I want to pull in some extremely basic data. This is my first rodeo with API, aside from figuring out how to pull in Twitch API. I have been wrestling with the Patreon API for two months now, and I must be missing something critical that I can’t glean from the docs.
What I’m trying to do first before I do anything else is just figure out the URL I’m supposed to be calling. I want to get number of patrons and total amount pledged to start with, so I can display it on my website. Once I can do that, I’ll expand to something more complex.
- I will work on environment variables/security measures/etc etc after I get the basic stuff working and I know that I’m on the right track.
Since there will be no sign in on the website, unless I’m mistaken, there’s no reason to go through the OAuth process. I just use my access token from the client I received. I just want to pull in variables that have nothing to do with who is signed in.
From what I understand, I’d be calling…
(where ##### = campaign_id)
…but of course that’s unauthorized, because there’s no access token.
So, I suppose my questions are:
- Do I have to go through the OAuth process every time, even though no one is logging in? The API docs say you can use your access_token in place of OAuth when making API calls, but does not make it clear how to do so.
- Is there really no way to limit the scope of the client when you make it? If someone got a hold of my client ID & secret or access token, they could just pull any information whatsoever and there’s seriously no way to say “just look at the public stuff please”?
- Is it impossible to call the URL on a browser without going through the OAuth first, and therefore I have to do it in subsequent XMLHttpRequests?
- Is my problem maybe that my client, including the redirect URI, is currently using localhost? Will the redirect URI break things if I’m never using it, since no one is being redirected anywhere?
Let me know what I’m missing. I know I’m new to this, but I’m fairly competent as a coder and a learner, and my husband is more capable still, and we’re both stumped right now.
Thanks in advance!