Not able to grnerate session

Raghavendrak
data = kite.generate_session(refresh_token, api_secret=api_secret)
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.6/dist-packages/kiteconnect-3.8.1-py3.6.egg/kiteconnect/connect.py", line 252, in generate_session
File "/usr/local/lib/python3.6/dist-packages/kiteconnect-3.8.1-py3.6.egg/kiteconnect/connect.py", line 821, in _post
File "/usr/local/lib/python3.6/dist-packages/kiteconnect-3.8.1-py3.6.egg/kiteconnect/connect.py", line 886, in _request
kiteconnect.exceptions.TokenException: Token is invalid or has expired.

data = kite.generate_session(refresh_token, api_secret=api_secret)
Traceback (most recent call last):
File "", line 1, in
File "/Users/rak/.virtualenvs/kite/lib/python3.7/site-packages/kiteconnect-3.8.1-py3.7.egg/kiteconnect/connect.py", line 252, in generate_session
File "/Users/rak/.virtualenvs/kite/lib/python3.7/site-packages/kiteconnect-3.8.1-py3.7.egg/kiteconnect/connect.py", line 821, in _post
File "/Users/rak/.virtualenvs/kite/lib/python3.7/site-packages/kiteconnect-3.8.1-py3.7.egg/kiteconnect/connect.py", line 886, in _request
kiteconnect.exceptions.TokenException: Token is invalid or has expired.


Tried this with different python versions.
Need assistance.
This discussion has been closed.