Hi
I have checked that my client id (apikey) and redirect_uri are correct before running the python script given below in visual studio code environment. But the web link generated by the python script for generating authorization code in web browser gives error “errorCode”:“UDAPI100060”. I have checked several topics on this error but could not solve the issue. I am posting the python script and error generated when I paste the web link in the browser. Please help me .
Regards
PYTHON SCRIPT
from urllib.parse import urlencode
import random
import string
Define your client ID and redirect URI
client_id = ‘your_client_id’ # Replace with your actual client ID
redirect_uri = ‘http://127.0.0.1’ # Replace with your actual redirect URI
Parameters for the OAuth 2.0 request
response_type = ‘code’ # This should remain ‘code’
scope = ‘profile’ # Change this based on the level of access you need
state = ‘’.join(random.choices(string.ascii_uppercase + string.digits, k=10)) # Generate a random state
Prepare the URL for generating the authorization code
params = {
‘client_id’: client_id,
‘redirect_uri’: redirect_uri,
‘response_type’: response_type,
‘scope’: scope,
‘state’: state,
}
Construct the authorization URL
auth_url = f"https://api-v2.upstox.com/login?{urlencode(params)}"
print(“Open the following URL in your browser to authorize the application:”)
print(auth_url)
ERROR GENERATED WHEN I PASTE THE ABOVE LINK IN WEB BROWSER:
{“status”:“error”,“errors”:[{“errorCode”:“UDAPI100060”,“message”:“Resource not Found.”,“propertyPath”:null,“invalidValue”:null,“error_code”:“UDAPI100060”,“property_path”:null,“invalid_value”:null}]}