☰
Login
Signup
Home
›
Kite Publisher
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
13.8K
All Categories
0
Incidents
152
Node JS client
39
Go client
791
.Net API client
378
Kite Publisher
537
.Net / VBA / Excel (3rd party)
457
Algorithms and Strategies
992
Java client
1.1K
API clients
402
PHP client
4K
Python client
346
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.3K
General
In this Discussion
November 2021
SRIJAN
November 2021
Dileep
November 2021
sujith
facing TokenException
Dileep
November 2021
in
Kite Publisher
Hi.. I am getting the below error for "kite.positions()"
kiteconnect.exceptions.TokenException: Incorrect `api_key` or `access_token`..But i am successfully generate accesstoken and able to subscribe the symbols.Help is much appriciated.
Tagged:
@sujith
@rakeshr
sujith
November 2021
Are you sure, you are not calling generateSession again?
Dileep
November 2021
Hi
@sujith
. I am not calling generate session again.If you want i will send my API KEY.
sujith
November 2021
You can run javakiteconnect with debug flag and paste the complete error json with status code here.
Also paste the response and status code of the api that is successful also.
PS: Make sure to remove app or client specific tokens.
Dileep
November 2021
edited November 2021
Hi
@sujith
,
I am using python client. This is below my code.
from kiteconnect import KiteConnect
try:
api_key=''
kite=KiteConnect(api_key)
print(kite)
Instruments=kite.instruments()
print("Successfully fetched the Instruments")
a= kite.positions()
print("Successfully fetched the Positions")
except Exception as e:
print(str(e))
Console Output:
Successfully fetched the Instruments
Invalid `api_key` or `access_token`.
APIKEY_Error.PNG
35.2K
SRIJAN
November 2021
edited November 2021
You have to use kite.set_access_token. Otherwise it won't work. Follow the proper documentation.
Dileep
November 2021
Thanks
@sujith
@SRIJAIN
. Now i am able to fetch . You can close this discussion.
This discussion has been closed.
Also paste the response and status code of the api that is successful also.
PS: Make sure to remove app or client specific tokens.
I am using python client. This is below my code.
from kiteconnect import KiteConnect
try:
api_key=''
kite=KiteConnect(api_key)
print(kite)
Instruments=kite.instruments()
print("Successfully fetched the Instruments")
a= kite.positions()
print("Successfully fetched the Positions")
except Exception as e:
print(str(e))
Console Output:
Successfully fetched the Instruments
Invalid `api_key` or `access_token`.