Closed pv-ajay-thota closed 3 years ago
Hi, this time I modified my token type to (Self-contained JWT) and got different types of unauthorized issues.
client = ks_api.KSTradeApi(access_token=access_token,
userid=userid,
consumer_key=consumer_key,
ip=ip,
app_id=app_id,
host=sandbox_env_host
)
all the variables are substitutes copied from this below url default application.
https://ctradeapi.kotaksecurities.com/devportal/applications/*******-****-*****-*****-*****/sandboxkeys/oauth
please find the traceback.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\ajay\Work\Projects\Trading_StockMarket\trade_venv\lib\site-packages\ks_api_client\ks_api.py", line 24, in __init__
session_init_res = ks_api_client.SessionApi(self.api_client).session_init(self.userid, \
File "D:\ajay\Work\Projects\Trading_StockMarket\trade_venv\lib\site-packages\ks_api_client\api\session_api.py", line 397, in session_init
return self.session_init_with_http_info(userid, consumerKey, ip, appId, **kwargs) # noqa: E501
File "D:\ajay\Work\Projects\Trading_StockMarket\trade_venv\lib\site-packages\ks_api_client\api\session_api.py", line 510, in session_init_with_http_info
return self.api_client.call_api(
File "D:\ajay\Work\Projects\Trading_StockMarket\trade_venv\lib\site-packages\ks_api_client\api_client.py", line 354, in call_api
return self.__call_api(resource_path, method,
File "D:\ajay\Work\Projects\Trading_StockMarket\trade_venv\lib\site-packages\ks_api_client\api_client.py", line 173, in __call_api
raise e
File "D:\ajay\Work\Projects\Trading_StockMarket\trade_venv\lib\site-packages\ks_api_client\api_client.py", line 166, in __call_api
response_data = self.request(
File "D:\ajay\Work\Projects\Trading_StockMarket\trade_venv\lib\site-packages\ks_api_client\api_client.py", line 380, in request
return self.rest_client.GET(url,
File "D:\ajay\Work\Projects\Trading_StockMarket\trade_venv\lib\site-packages\ks_api_client\rest.py", line 220, in GET
return self.request("GET", url,
File "D:\ajay\Work\Projects\Trading_StockMarket\trade_venv\lib\site-packages\ks_api_client\rest.py", line 214, in request
raise ApiException(status = r.status, reason = r.reason, body = r.data)
ks_api_client.exceptions.ApiException: (401)
Reason: Unauthorized
HTTP response body: {"fault":{"code":900901,"message":"Invalid Credentials","description":"Invalid JWT token. Signature verification failed.. Make sure you have provided the correct security credentials"}}
UPDATE: so I spoke to the Kotak trade API team and I got to know that I do not have access to the sandbox environment where I am trying to log in. and yeah for convenience while generating an access token we can set the expiry time to '-1' so that access_token never expires. so as of now, I can say it is resolved for me.
Hi Guys, I get Invalid Credentials and unauthorized. Do we need to base64 encode consumer_key or any other key? and where is the consumer_secret is used? I could see a settings.py. file. do we need to configure that before using it?
all the variables are substitutes copied from this below url default application.
still I get this error.
please find the traceback.