/current_user works, but /current_user/campagns returns empty

Hi!

I’m making a simple app with Node/Express where I’m going to give access to the user if they are supporting me/my Patreon page, but only if they are on a certain tier. I’ve managed to get info about the user through the /current_user request, but once I try to get info about their pledge etc through /current_user/campagns I get this as a response:

{ data: [] }

Here is my request code:

function handleOAuthRedirectRequest(request, response) {
    const oauthGrantCode = url.parse(request.url, true).query.code;

    patreonOAuthClient
        .getTokens(oauthGrantCode, patreonRedirectUrl)
        .then(function(tokensResponse) {
            var patreonAPIClient = patreonAPI(tokensResponse.access_token);
            return patreonAPIClient('/current_user/campaigns')
        })
        .then(function(result) { 
            console.log('respons: ', result.rawJson);

            //this is where the magic will happen IF I can get /campaigns to work
            
        })
        .catch(function(err) { 
            console.error('error!', err) 
            response.end(err)
        })
}

Thanks!

Try to use v2 endpoints rather than v1 endpoints.

https://docs.patreon.com/#apiv2-resource-endpoints

That worked! Thanks!

1 Like