Hey All,
I have a very minor Python app which downloads my transactions offline.
I set it up using a very simple set-up:
- create a client using localhost as the redirect uri
- got the authorization_code from the email which was sent
- used the request library to obtain the access and refresh tokens:
url = ‘https://api.monzo.com/oauth2/token’
headers = {
“grant_type”:“authorization_code”,
“client_id”:client_id, -> being the client I registered online
‘client_secret’:client_secret, -> being the secret I obtained once I registered the client
‘redirect_uri’:‘https://localhost’,
‘code’:authorization_code -> being the code obtained from step 2
}
res = r.post(url,data = headers).text -> this gave me the access code
After this I am able to query items in my account, i.e.
monzo = "api.monzo.com"
#get list of accounts
response = requests.get("https://{}/{}".format(monzo, 'accounts'),
headers={"Authorization": "Bearer {}".format(access_token)})
The above code works and gives me list of accounts. However, when I try to get my transactions using the below code, I get a 403 response:
params_data = {
"account_id": account_id }
response = requests.get("https://{}/{}".format(monzo, 'balance'),
headers={"Authorization": "Bearer {}".format(access_token)},
params=params_data)
response = “code”:“forbidden.verification_required”,“message”:“Verification required”
Any idea why this would happen?
How can I fix it?