Hi, I am getting this error kiteconnect.exceptions.TokenException: Incorrect `api_key` or `access_token`.
I have followed following steps. 1. 500 subscription bought and Active 2. Static IP updated in my profile 3. New App created and API KEY and API SECRET fetched 4. Using python kite connect kit installed and further using API Key and Secret Token fetched 5. using API KEY, API Secret and Token successfully logged in (where python can get my name and trade ID properly). 6. Verified using below code: printf 'KEY=[%s] len=%d\n' "$KITE_API_KEY" $(printf '%s' "$KITE_API_KEY" | wc -c) printf 'TOKEN start=[%s] len=%d\n' "$(printf '%s' "$KITE_ACCESS_TOKEN" | cut -c1-6)" $(printf '%s' "$KITE_ACCESS_TOKEN" | wc -c) 7. then I tested this for final ensure python3 -c "import os; from kiteconnect import KiteConnect; k=KiteConnect(os.getenv('KITE_API_KEY')); k.set_access_token(os.getenv('KITE_ACCESS_TOKEN')); print('OK', k.profile()['user_name'])"
Got the above error. Full output message is below
Traceback (most recent call last): File "", line 1, in import os; from kiteconnect import KiteConnect; k=KiteConnect(os.getenv('KITE_API_KEY')); k.set_access_token(os.getenv('KITE_ACCESS_TOKEN')); print('OK', k.profile()['user_name']) ~~~~~~~~~^^ File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/site-packages/kiteconnect/connect.py", line 336, in profile return self._get("user.profile") ~~~~~~~~~^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/site-packages/kiteconnect/connect.py", line 872, in _get return self._request(route, "GET", url_args=url_args, params=params, is_json=is_json) ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/site-packages/kiteconnect/connect.py", line 948, in _request raise exp(data["message"], code=r.status_code) kiteconnect.exceptions.TokenException: Incorrect `api_key` or `access_token`.