Initializing the client [Javascript]


(Erik Whipp) #1

Hey all,

I’m looking for some guidance regarding initializing my application. I have followed the docs to a tee and am moreso wondering about the response I’m getting rather than my code. I have used Postman to verify the functionality of my code – Postman works as expected – I receive an application token. However, when I use my application I receive the following :

    {"_links":
    {"self":
    {"href":
    "https://api-sandbox.dwolla.com/webhook-subscriptions","type":"application/vnd.dwolla.v1.hal+json","resource-type":"webhook-subscription"}},"_embedded":{"webho
    ok-subscriptions":[]},"total":0}

My code is the following :

        var client = new dwolla.Client({
        key: process.env.DWOLLA_APP_ID,
        secret: process.env.DWOLLA_APP_SECRET,
        grant_type: 'client_credentials',
        environment: 'sandbox'
      });

  client.auth.client().then(function(appToken) {
      return appToken.get('webhook-subscriptions');
  }).then(function(res) {
      console.log(JSON.stringify(res.body));
  })

Any help would be appreciated as well as the time spent to aid me in my efforts.


(Erik Whipp) #2

So everyone knows, I needed to have a promise function as well as take off the grant_type.