Can't authorize

I got this message

{"status":"error","errors":[{"errorCode":"","message":"Required String parameter 'client_id' is not present","propertyPath":"client_id","invalidValue":null,"error_code":"","property_path":"client_id","invalid_value":null}]}

here is my code

 import requests

url = "https://api.upstox.com/v2/login/authorization/dialog"

payload={
    'code': code,
    'client_id': apiKey
    'client_secret': secretKey,
    'redirect_uri': rurl,
    'grant_type':'authorization_code'
}
headers = {'Api-Version':'2.0'}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

pay load

{'code': 'dtRlWO',
 'client_id': '64bdc776-95fd-491f-bbde-d4007c08c5fb',
 'client_secret': 'yq781r2sot',
 'redirect_uri': 'https%3A%2F%2F127.0.0.1%3A3000',
 'grant_type': 'authorization_code'}

@Manoj_AP

In the code you provided, the items in payload are being sent as the body of the request, not as request parameters. For this API, you should send the data as request parameters, not in the body. Please make this change and try again.

Thanks!

1 Like