"Missing or invalid scopes" when create funding source for master account in sandbox

Hi! I’m trying to add funding source for master account in sandbox.
i do:
const url = ‘https://api-sandbox.dwolla.com/funding-sources
(url from here https://docs.dwolla.com/#create-a-funding-source-for-an-account)

this.dwolla = new dwolla.Client(config); //key,secret,env=sandbox
this.dwolla.auth.client()
.then((token) => {
token.post(url, data).then… //name,accountNum etc

but i get "Missing or invalid scopes for requested endpoint.”

What did i do wrong?

Thank you in advance,
Andrey

Hi @Andrey_Kaloshin – would you be able to post your Account ID or any ID related to your Sandbox account for us to take a look? Also, if you have the request-id for this request that returned the above error, that would help too!

Thanks!

Hi @shreya, account # is “bbcbc7b1-81ec-46cc-8316-3180451b770c”

and from headers:
x-request-id: (1) [‘da1a2ebd-1817-4134-b3b4-e214a099eb07’]

Andrey,
BR

Hi @Andrey_Kaloshin, thanks for the IDs! I was able to look up the request body, and it seems that the error has to do with the routingNumber and accountNumber values that were provided.

“routingNumber”: “dasdas”,
“accountNumber”: “123”,

If you update the values according to the specs defined in this section of our API reference docs, the request should pass successfully. Here’s an example request-body that works -

{
    "routingNumber": "222222226",
    "accountNumber": "123456789",
    "bankAccountType": "checking",
    "name": "My Bank"
}

Having said that, for the above error, the error type that should have been returned is a BadRequest error and not an InvalidScope error. I can create a ticket for our team to update the error message returned. Thanks for bringing this to our attention!

1 Like

Yes, i didn’t validate input yet, it’s just a test run; and yes, i expected BadRequest for return. Thank you @shreya!

BR,
Andrey

1 Like

Hi @shreya, I have the same error for the same endpoint but using Plaid + dwolla-v2 (node).

    const params = {
      plaidToken: plaidToken,
      name: name
    }

    dwolla
      .post("funding-sources", params)
            .then((response) => {
             ...

I know I need to put the customer id or link somewhere, but not sure where, or even if this is supported by the library. Thanks!

@francopetra, you should be able to do something like the following:

const customerA = 'https://api-sandbox.dwolla.com/customers/07d59716-ef22-4fe6-98e8-f3190233dfb8;
const params = {
      plaidToken: plaidToken,
      name: name
    };

dwolla
  .post(`${customerA}/funding-sources`, params)
 .......

Looks like you just need to update the request URL to include the Customer you’re adding a funding source to. Let us know if that works for you!

1 Like