node-ppaccess

Node helpers for dealing with PayPal Access (OAuth) requests, mainly for testing with Mocha

npm install node-ppaccess
4 downloads in the last month

This module contains an interface for creating and making OAuth based requests to PayPal services. When combined with node-gmapi-login, it lets you perform tests of PayPal Access-based APIs with simple usernames, like so:

var oauth = new OAuth({
    host: host,
    appId: "hereapimochatests",
    returnUrl: "https://appsforhere.com/foobar"
});

gmapi.login({
    email: 'sp-us-b1@paypal.com',
    host: "www.stage2md030.qa.paypal.com"
}, function (error, token) {
    oauth.accessTokenFromSlimToken(token.token, "openid email", function (oError, oTokenInfo) {
        if (oError) {
            console.log(oError);
        } else {
            console.log("Access Token :", oTokenInfo);
            // You can now call APIs using the oauth.request/get/delete functions
        }
    });
});

Note that the module will also try to CREATE the appId for you if it believes it doesn't yet exist on the server. Handy right?

npm loves you