I’ve trying to use the Patreon authentication mechanism and have been trying to get it to work for several days now.
I’ve gotten to step 4 but can’t seem to get any further.
When calling the API using cURL commands, to the URL mentioned (www.patreon.com/api/oauth2/token?) to retrieve a token I get 301 responses.
If I use the -L flag to follow the redirect I just get a HTML response.
If I make the same request to api.patreon.com/api/oauth2/token, then I get the following response:
{
“errors”: [
{
“code”: null,
“code_name”: “AdminAccessDenied”,
“detail”: “You do not have permission to use this admin tool.”,
“id”: “9c33ec5c-ea63-4ca2-b1c3-9c5a25a118da”,
“status”: “403”,
“title”: “You do not have permission to use this admin tool.”
}
]
}
I’ve also tried to call this API using a POST request as the documentation specifies but I get a 403 instead.
The issue is most likely because you’re making requests over http instead of https: the API is instructing your client to retry the request over https (hence the redirect) but POST requests cannot be redirected with POST data; the data is being lost. The solution is to make your requests to https://www.patreon.com/api/oauth2/token.
Actually, it looks like when requests are made to the API over http, Patreon redirects to the root instead of the current path but over https.
[edit: actually, ignore all this, there’s no POST data involved. I’ve spent too much time working with other APIs and I’ve forgotten how OAuth works. Shame. The problem does appear to be that Patreon’s http → https redirect doesn’t redirect correctly]
As general programming advice: always communicate over https, never http — unless there is a specific situation that dictates you must communicate over http.
If this does not resolve your issue please share the command(s) that you’re using to query the API.
If anyone comes upon this trouble. It may simply be because you are formatting the data incorrectly to send for the POST. In my case I was doing in JS fetch like this: