InvalidScopeError in sandbox when listing funding sources

I’m using the dwolla ruby gem (https://github.com/Dwolla/dwolla-v2-ruby). I have dwolla configured as such:

$dwolla = DwollaV2::Client.new(
  key: ENV["DWOLLA_APP_KEY"],
  secret: ENV["DWOLLA_APP_SECRET"],
  environment: Rails.env.production? ? :production : :sandbox
)

confirmed I’m in sandbox in console. running $dwolla returns #<DwollaV2::Client key="RxWTKzcPctZTMG242JZXmA4GimbR1rr7PpAF5Z8CGP3reKZWlf" environment=:sandbox>

I generated an app_token by:
app_token = $dwolla.auths.client

When trying to list funding sources I get the InvalidScopeError 401 response:

I understand that this functionality is limited in production to those with with a specific scope that was approved by dwolla (ex. ManageCustomers), but am under the impression sandbox should have no such limitations

This person seemed to have the same problem but no resolution is listed: InvalidScopeError when listing funding sources

Hi @alisonmtague – That’s correct, Sandbox doesn’t have limitation on the default settings like creating Customers, funding-sources and transfers.

For this particular error, it looks like the account id in the request endpoint is actually a Customer id. In order to list the funding-sources for a Customer, the endpoint you want to call would be the following -

https://api-sandbox.dwolla.com/customers/683fc6f1-6c69-439f-8447-3905821c12e4/funding-sources

Let me know if that fixes the issue!