(Production) InvalidTokenType : The requested endpoint requires an account token


(Rashmi M Mhatre ) #1

Hi All,

Now I am switching to production. And getting below error while creating new customer.

{ 
   "code":"InvalidTokenType",
   "message":"The requested endpoint requires an account token."
}

My code looks like,

'getDwollaAccount' : function(userId) {
 var dwollaCredentials = getDwollaCreden();
 const client = new dwolla.Client({
 key         : dwollaCredentials.appKey,
 secret      : dwollaCredentials.appSecret,
 environment : 'production' // optional - defaults to production
 }); // call dwolla initial api

client.auth.client()
.then(Meteor.bindEnvironment(function(appToken) {

var userFound = 
Meteor.users.findOne({'_id':userId,'profile.dwollaLocation':''});
if(userFound){
    var requestBody = {
      firstName : userFound.profile.firstname,
      lastName  : userFound.profile.lastname,
      email     : userFound.emails[0].address
    };
    appToken
        .post('customers', requestBody)
        .then( 
            (res)=> {
                var dwollaLocation = res.headers.get('location');;      
                return Promise.resolve(dwollaLocation);
            }
        )
        .then(
            Meteor.bindEnvironment((dloc) =>{ 
                    return Promise.resolve(dloc);
            })
        )
        .catch(Meteor.bindEnvironment((error) => {
           console.log(error);
                          }));  
} // end of user found
})
);
},

Do I also need to contact sales team for further process.

Thanks in advance!


(Spencer Hunter) #2

@Rashmi_M_Mhatre, Yes, It looks like you’re attempting to POST to /customers which requires an API services agreement with Dwolla.