Closed ExpertSeahorse closed 3 years ago
An error in log_out
often means that either your token isn't valid, or it has been revoked. Try creating a Client
with your token again and do something with it, see if it still works?
I created a new token, created a $0.01 charge to someone, then ran Client.log_out().
Same traceback error.
Is this how you are logging out?
Client.log_out(token)
? You need to pass your token as the argument to the function. If it's, then try the following, it'll show you the error if there's one:
import requests
token = "Bearer ......" # this should be your access token
def revoke_token(token):
header = {
"Authorization": token,
"User-Agent": "Venmo/8.6.1 (iPhone; iOS 13.0; Scale/3.0)"
}
url = "https://api.venmo.com/v1/oauth/access_token"
response = requests.delete(url, headers=header)
if response.status_code != 200:
print("ERROR:")
print(response.status_code, response.reason, response.text)
return 0
json = response.json()
print("Successfully logged out:\n", json)
revoke_token(token)
FYI, you don't have to log in and log_out every time. You can log in once, and keep using your access token as long as you want. Just make sure to keep your token somewhere secure, and remember that it never gets expired, so you'll have to revoke it at some point.
My access token is just in the format "sdaf456sadf", without 'Bearer' (or my username?) at the beginning. Does this change anything?
Yes, that's probably why it's failing. It should be Bearer sdaf45fgfgdx....
That's a good point tho. I'll update it later on to also accept sdaf456sadf
since Client
itself accepts both formats.
Feel free to comment here if you're still having issues with log_out
The following is my traceback: