The following cURL command is functioning correctly. Please ensure that all necessary parameters are included as specified. Additionally, a sample authentication code is included in the cURL command to help clarify the required format, in case there was any confusion about it.
curl --location 'https://api.upstox.com/v2/login/authorization/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--data-urlencode 'client_id=<client_id>' \
--data-urlencode 'client_secret=<client_secret>' \
--data-urlencode 'code=gUYpiy' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'redirect_uri=<redirect_uri>'
To bypass potential local coding issues, I recommend testing the provided cURL command using Postman. This will help determine if the problem is with the code or elsewhere.
Thanks!!!