Invalid `api_key` or `access_token`

sachi
Hi Team,

I have followed the required steps of placing an order, but getting an error while trying to place the order "Invalid `api_key` or `access_token`". A quick help from expert developers here would be highly appreciated.

data = kite.generate_session(REQUEST_TOKEN, api_secret=API_SECRET)
kite.set_access_token(data["access_token"])

data

{'user_type': 'individual',
'email': '***@gmail.com',
'user_name': '***',
'user_shortname': '***',
'broker': 'ZERODHA',
'exchanges': ['NSE', 'MF', 'BSE', 'BFO', 'NFO', 'CDS'],
'products': ['CNC', 'NRML', 'MIS', 'BO', 'CO'],
'order_types': ['MARKET', 'LIMIT', 'SL', 'SL-M'],
'avatar_url': None,
'user_id': '####',
'api_key': '####',
'access_token': '####',
'public_token': '####',
'refresh_token': '',
'enctoken': '####',
'login_time': datetime.datetime(2022, 7, 16, 12, 41, 33),
'meta': {'demat_consent': 'physical'}}

kite.place_order(tradingsymbol="INFY", quantity=1, exchange = "NSE", transaction_type="BUY",order_type="MARKET",
product="CNC", variety="AMO")


DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "POST /orders/AMO HTTP/1.1" 308 0
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): api.kite.trade:80
DEBUG:urllib3.connectionpool:http://api.kite.trade:80 "POST /orders/amo HTTP/1.1" 301 None
DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /orders/amo HTTP/1.1" 400 109

InputException: Invalid `api_key` or `access_token`.
This discussion has been closed.