Please help me in getting the access token from request access code.
I used the code:

from kiteconnect import KiteConnect
import logging
# Redirect URL specified in your Kite Connect app settings
redirect_url = "YOUR_REDIRECT_URL"
# Initialize KiteConnect instance
kite = KiteConnect('xxxx')

# Get the authorization URL
login_url = kite.login_url()

# Redirect the user to the login URL
print("Please login to Zerodha and grant permission:")

# After successful login and permission, get the request token
request_token = input("Enter the request token: ")
data = kite.generate_session(request_token=request_token, api_secret='yyy')

# Get the access token
access_token = data["access_token"]

# Print the access token
print("Access Token:", access_token)

The error i got from using this code:
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1):
DEBUG:urllib3.connectionpool: "POST /session/token HTTP/1.1" 403 None
Traceback (most recent call last):
File "", line 19, in
data = kite.generate_session(request_token=request_token, api_secret='yyyy')
File "venv\lib\site-packages\kiteconnect\", line 262, in generate_session
resp = self._post("api.token", params={
File "venv\lib\site-packages\kiteconnect\", line 855, in _post
return self._request(route, "POST", url_args=url_args, params=params, is_json=is_json, query_params=query_params)
File "venv\lib\site-packages\kiteconnect\", line 927, in _request
raise exp(data["message"], code=r.status_code)
kiteconnect.exceptions.TokenException: Token is invalid or has expired.

Process finished with exit code 1

This discussion has been closed.