I have a serverless function that gets triggered by a Patreon webhook on new pledges and pledge updates. From that hook’s payload, I can get the user ID, and even the URL to, I assumed, the API endpoint that will give me more details about that user. For example, testing the webhook, returns https://www.patreon.com/api/user/XXXXX under data.relationships.user.links.related.
Unfortunately, trying to GET that endpoint, results in error 403 Unauthorized, but only when called from the serverless function. If I access this endpoint from the browser, including an incognito window, I see the entire JSON payload with all the data I would need.
The V2 is cool and all, but it seems to require OAuth2 authentication. Since I’m running it as a serverless function, using some sort of an API key would be much simpler than OAuth
I could maybe store it in as env variables… So your suggestion is to create a one-off function that would fetch the OAuth tokens, save them somewhere, and have the actual functions reuse them? I’ll have to try it out
Wouldnt env variables get cleared on any reboot. It would be much easier to have a database (any). That would enable you to build more complex functionality in future as well.