Problem in getting access token

Hi,
I am trying to get the access token. I have following code
var request = new HttpRequestMessage(HttpMethod.Post, “https://api-v2.upstox.com/oauth/token”);

var body = new
{
client_id = _apiKey,
client_secret = _apiSecret,
code = authorizationCode,
grant_type = “authorization_code”,
redirect_uri = _redirectUrl
};

request.Content = new StringContent(JsonConvert.SerializeObject(body), System.Text.Encoding.UTF8, “application/json”);

var response = await client.SendAsync(request);
var responseContent = await response.Content.ReadAsStringAsync();
But above code gives error
Responsecontent
“{"status":"error","errors":[{"errorCode":"UDAPI100060","message":"Resource not Found.","propertyPath":null,"invalidValue":null,"error_code":"UDAPI100060","property_path":null,"invalid_value":null}]}”

Please guide me about whats wrong in the code

Hello Team,
please reply to my query at earliest as i am not able to proceed further with coding.

Hi @LSAPTE
The error Resource not Found indicates that an incorrect endpoint is being used.

Please ensure that you are using the correct endpoints for authorization:

  • https://api.upstox.com/v2/login/authorization/dialog
  • https://api.upstox.com/v2/login/authorization/token

For further details, refer to the Documentation | Authentication.