I’ve been trying to figure out this series of errors for awhile now and the errors in the docs are just incredibly unhelpful with how vague they are.
Here’s my code (I’m using NodeJS):
function handleOAuthRedirectRequest (req, res) {
let {code} = req.query
axios.post(https://www.patreon.com/api/oauth2/token?code=${code}&grant_type=authorization_code&client_id=${patreonId}&client_secret=${patreonSecret}&redirect_uri=${redirect}
, {}, {headers: {‘Content-Type’: ‘application/x-www-form-urlencoded’}})
.then(result => console.log(result))
.catch(e=>console.log(e))
}
And I’m getting a 401 { error: ‘invalid_grant’ }.
When I change it to …&grant_type=_code&client_id…
I get 400 { error: ‘unsupported_grant_type’ }
I’ve also tried pushing everything through in the body and that didn’t work either.
What do these errors mean? What am I doing wrong?