I am working on my website where I need to see the id, username and the pledges to me using patreon
I use simple-oauth2 and axios for most of my work
I use this code to generate a authorization code:
const client = new oauth2.AuthorizationCode({
client: {
id: Settings.oauth.id,
secret: Settings.oauth.secret
},
auth: {
tokenHost: 'https://www.patreon.com',
authorizePath: '/oauth2/authorize',
tokenPath: '/api/oauth2/token'
}
});
const authorizationUri = client.authorizeURL({
redirect_uri: 'https://www.bloxxy.net/api/patreon/callback',
});
And this code to get the username, id, and relationships:
axios.get("https://www.patreon.com/api/oauth2/api/current_user", {headers: {
Authorization: `Bearer ${access_token}`
}}).then((data) => {
resolve(data.data.data)
}).catch((err) => {
let accessToken = client.createToken(req.session.patreon.request)
accessToken.revoke('access_token').catch((err) => {});
accessToken.revoke('refresh_token').catch((err) => {});
req.session.patreon = undefined
res.redirect("/account");
reject(err.message)
})
When I do it on my creator account everything works fine, but for all other accounts it returns error 403.