I am getting the pledges using this way:
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)
})
And making the authorization url this way:
const client = new oauth2.AuthorizationCode({
client: {
id: Settings.oauth.id,
secret: Settings.oauth.secret
},
auth: {
tokenHost: 'https://www.patreon.com',
authorizeHost: 'https://www.patreon.com',
authorizePath: '/oauth2/authorize',
tokenPath: '/api/oauth2/token'
}
});
const authorizationUri = client.authorizeURL({
redirect_uri: 'https://www.bloxxy.net/api/patreon/callback',
scope: "my-campaign pledges-to-me users"
});
And when reading userInfo.relationships.pledges.data each pledge is { id:'a_ID, type: 'pledge' }
but there is no attribute key to give me the money sent