Weblink generated by python script for creating authorization code gives error "errorCode":"UDAPI100060"

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}]}

Please verify the correct URLs in the documentation here: Authorize | Upstox Developer API.

https://api.upstox.com/v2/login/authorization/dialog?response_type=code&client_id=28ebb9a0-1b29-4955-8c6a-22b826f06a7c&redirect_uri=https://www.niftyalpha.in/

What’s wrong in this url?

I am getting

{“status”:“error”,“errors”:[{“errorCode”:“UDAPI100068”,“message”:“Check your ‘client_id’ and ‘redirect_uri’; one or both are incorrect.”,“propertyPath”:null,“invalidValue”:null,“error_code”:“UDAPI100068”,“property_path”:null,“invalid_value”:null}]}

Hi @Sudharshan
The error message suggests that your client ID or redirect URL does not match the details provided for the app you’re using to generate an access token. You can refer to this article for the steps to create an app.

Thank you.