NodeJS: Dwolla.finishAuth() returns undefined results

(Trent Tech) #1

I’ve successfully created an authUrl using Dwolla’s official Node package, and I’ve successfully used my site to get a code from Dwolla and be redirected back to my site. I can grab this code, but can’t seem to get a refresh token as the results are undefined. Here is my code:

Dwolla.finishAuth(code, redirect_uri, function(err, auth) {
    console.log('Dwolla auth results...');
    var access_token = auth.access_token;
    var refresh_token = auth.refresh_token;

My console logs the following:

Dwolla auth results...
var access_token = auth.access_token;
TypeError: Cannot read property 'access_token' of undefined

Anyone see anything I’m missing here? Thanks.

(Gordon Zheng) #2

Hmm… perhaps the API call was not successful? What’s the value of err?

(Trent Tech) #3

What’s the value of err?

I should have thought of checking that. =P It returns:

[Error: Redirect Uri does not match redirect uri associated with token.]

I didn’t realize these had to be the same. That fixed the problem. Thanks!

(Gordon Zheng) #4

Sounds good! Let us know if you run into any other issues, @Trent :slight_smile:

(Manas) #5

in my case i’m getting this error
"Invalid application credentials."

(Spencer Hunter) #6

@manas.ghatage, Can you provide additional context? What you’ve tried, where you are running into issues, what the exact error is, is this related to the original topic post, etc.? Thanks!