I’m currently integrating Upstox API V2 into my application, and I’m facing an authentication issue that’s causing an “Invalid token used to access API” error (errorCode: UDAPI100050). I think you have to activate my profile for API. Please resolve this issue.I’ve tried troubleshooting the problem on my own, but I could use some guidance from the community.
Error:
{“status”:“error”,“errors”:[{“errorCode”:“UDAPI100050”,“message”:“Invalid token used to access API”,“propertyPath”:null,“invalidValue”:null,“error_code”:“UDAPI100050”,“property_path”:null,“invalid_value”:null}]}
api_instance = upstox_client.UserApi(upstox_client.ApiClient(configuration))
api_version = ‘V2’ # str | API Version Header
try:
# Get profile
api_response = api_instance.get_profile(api_version)
pprint(api_response)
except ApiException as e:
print(“Exception when calling UserApi->get_profile: %s\n” % e)
I am currently using the same code, and all the API installations are completed. During the API creation process, I did not subscribe to any Interactive or Historical API services. Consequently, I would like to know if it is necessary for me to subscribe to these services.
Please take note that including the API version as 2.0 is required.
I presume that the access token provided in this example is fictitious. Furthermore, could you please elaborate on the method you employ to retrieve the access token after the login process? For further information, you can refer to: Get Token | Upstox Developer API.
TTP Error 401: {“status”:“error”,“errors”:[{“errorCode”:“UDAPI100050”,“message”:“Invalid token used to access API”,“propertyPath”:null,“invalidValue”:null,“error_code”:“UDAPI100050”,“property_path”:null,“invalid_value”:null}]}
Below is the operational code for the ‘get profile’ API. It has been tested using a valid access token. Please verify if this code works for you. Additionally, kindly provide your UCC for us to track your request.
In one of your previous discussions, I noticed that you attempted to use the auth code as the access token, which would lead to an invalid access token.
You can obtain the access token from the https://api-v2.upstox.com/login/authorization/token endpoint and use it in subsequent requests to make API calls. Below is the sample working code to get an access token, It has been tested using a valid auth code.
All your segments are currently in a dormant state.
To activate the necessary segment, please access the segment section within your account or by clicking on the following link after login: Upstox Accounts