Strange bug dwolla-v2 node js


(Erik Whipp) #1

I have this weird bug going on… this is my code:

var redirect_uri = “http://localhost:3000/”;

var auth = new Dwolla.client.Auth({
redirect_uri: redirect_uri,
scope: 'ManageCustomers',
verified_account: true, 
dwolla_landing: 'register', 
});
res.redirect(auth.url);

auth.callback(req.query) // pass the code and optional state to the callback
.then(function(token) {
return token.get('/');
})
.then(function(res) {
console.log(JSON.stringify(res.body));
}); 

So when I run that, I get redirected to a login page at Dwolla, however, in my console it states: Unhandled rejection Error:

{"error":"access_denied","error_description":"Code required."}
at errorFrom (C:\Users\Erik Daniel Whipp\Desktop\capstone-project\node_modules\dwolla-v2\src\dwolla\Auth.js:12:15)
at handleTokenResponse (C:\Users\Erik Daniel Whipp\Desktop\capstone-project\node_modules\dwolla-v2\src\dwolla\Auth.js:21:27)
at tryCatcher (C:\Users\Erik Daniel Whipp\Desktop\capstone-project\node_modules\dwolla-v2\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\Erik Daniel Whipp\Desktop\capstone-project\node_modules\dwolla-v2\node_modules\bluebird\js\release\promise.js:504:31)
at Promise._settlePromise (C:\Users\Erik Daniel Whipp\Desktop\capstone-project\node_modules\dwolla-v2\node_modules\bluebird\js\release\promise.js:561:18)
at Promise._settlePromise0 (C:\Users\Erik Daniel Whipp\Desktop\capstone-project\node_modules\dwolla-v2\node_modules\bluebird\js\release\promise.js:606:10)
at Promise._settlePromises (C:\Users\Erik Daniel Whipp\Desktop\capstone-project\node_modules\dwolla-v2\node_modules\bluebird\js\release\promise.js:685:18)
at Async._drainQueue (C:\Users\Erik Daniel Whipp\Desktop\capstone-project\node_modules\dwolla-v2\node_modules\bluebird\js\release\async.js:138:16)
at Async._drainQueues (C:\Users\Erik Daniel Whipp\Desktop\capstone-project\node_modules\dwolla-v2\node_modules\bluebird\js\release\async.js:148:10)
at Immediate.Async.drainQueues (C:\Users\Erik Daniel Whipp\Desktop\capstone-project\node_modules\dwolla-v2\node_modules\bluebird\js\release\async.js:17:14)
at runCallback (timers.js:785:20)
at tryOnImmediate (timers.js:747:5)
at processImmediate [as _immediateCallback] (timers.js:718:5) 

My credentials are correct and when I console.log the auth.url this is what comes up:

https://sandbox.dwolla.com/oauth/v2/authenticate?response_type=code&client_id={{Client_ID}}&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F&scope=ManageCustomers&verified_account=true&dwolla_landing=register

Any help would be appreciated.


(Cory Anderson) #4

Issue resolved in Intercom message. He was trying to use Transfer Auth methods for Access API