Invalid refresh token / Access token is empty


#1

For the past two days, my refresh token has been rejected as invalid. We refresh it once daily so it should not be expiring.

To remedy this yesterday I used the API Keys page in my account to manually generate new tokens, and have proved that my code was good by manually executing it to refresh the access tokens. But hours later when the code runs again on schedule, I’m getting “Invalid refresh token”.

Any ideas for me?

I’m using python sdk which is POSTing to /oath/v2/token


| | _____ | | | __ _
/ \ \ /\ / / _ \| | |/ _ |
| (
| |\ V V / () | | | (| |
_,| _/_/ _
_/|||_,|

An official requests based wrapper for the Dwolla API

Support is available on our forums at:

Package – Dwolla/dwolla-python
Author – Dwolla (David Stancu): api@dwolla.com, david@dwolla.com
Copyright – Copyright © 2014 Dwolla Inc.
License – MIT
Version – 2.0.4
Link –


#2

Also getting “Access token is empty” when doing

accounts.balance(access_token)
which calls r._get(’/balance’, {‘oauth_token’: alternate_token if alternate_token else c.access_token})


#3

I’ve upgraded to latest version found here: https://github.com/Dwolla/dwolla-python

But now the SDK is breaking on parsing the response.
/dwolla/rest.py
def _parse()
if r[‘Success’] is not True:

key ‘Success’ is not found

The call itself look liked it worked, but the SDK is just failing to parse the response correctly.


#4

It looks like oauth.refresh() was changed from
return r._post(’/token/’, p, ‘/oauth/v2’, kwargs.pop(‘dwollaparse’, ‘dict’))
to
return r._post_without_token(’/token/’, p, kwargs, custompostfix=’/oauth/v2’)

since you’re no longer passing ‘dwollaparse’ as ‘dict’, _parse() is incorrectly processing the response as ‘dwolla’


#5

I resolved this by adding

kwargs[‘dwollaparse’] = ‘dict’

just before

return r._post_without_token(’/token/’, p, kwargs, custompostfix=’/oauth/v2’)

in oauth.refresh()


#6

pull request is up… I have no idea what other endpoints may suffer a similar fate.


(Spencer Hunter) #7

Apologies for the inconvenience on this issue, and thanks for the contribution! We merged and updated those changes, but please let us know if you continue to experience issues with the SDK.