Check your 'client_id' and 'redirect_uri'; one or both are incorrect

    def generate_code(self):
        redirect_url = urllib.parse.quote("https:/127.0.0.1:8080/", safe="")
        print(redirect_url)
        # redirect_url = https%3A%2F127.0.0.1%3A8080%2F
        url = f"https://api.upstox.com/v2/login/authorization/dialog?response_type=code&client_id={self.api_key}&redirect_uri={redirect_url}"
        print(url)
        # https://api.upstox.com/v2/login/authorization/dialog?response_type=code&client_id=3f7781a2-422d-43a7-9b0a-e7e753e94083&redirect_uri=https%3A%2F127.0.0.1%3A5000%2F
        response = requests.get(url)

response received

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

Can somebody help why failing for client_id and redirect url even though its correct. I tried searching but couldnt find appropriate solution for the same.

@Kamta_sahu, please ensure that you are using the same client_id and redirect_url as specified in the apps section of your Upstox profile.

Additionally, could you share your cURL request? This will help us better understand the request you are sending to obtain the auth code.

Thank you.

It got fixed. The url port was diff. Thanks

1 Like