Getting token Exception Error

anson
generated a new access token and tried the below code I'm getting
{"status":"error","message":"Incorrect `api_key` or `access_token`.","data":null,"error_type":"TokenException"}

headers = {
'X-Kite-Version': '3',
'Authorization': 'token api_key:{}'.format(access_token)
}

response = requests.get('https://api.kite.trade/trades', headers=headers)
print("response", response.text)
  • SRIJAN
    SRIJAN edited February 2022
    Take your api_key out of quotes. What you have written is literally 'api_key'. It should be actual api_key like 'XXXXXX'. Like this:

    headers = {
    'X-Kite-Version': '3',
    'Authorization': 'token {}:{}'.format(api_key,access_token)
    }
This discussion has been closed.