Hi, I am trying to get an access token using a c# program with password grant. My code is based on what I have found in the API Playgroud, and looks like this:
// Determine endpoint
var client = new RestClient("https://api.refinitiv.com/auth/oauth2/v1/token");
client.Timeout = -1;
// Get credential
string user = ConfigurationManager.AppSettings.Get("RefinitivUser");
string password = ConfigurationManager.AppSettings.Get("RefinitivPassword");
string appKey = ConfigurationManager.AppSettings.Get("RefinitivAppKey");
// Set up the request
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/x-www-form-urlencoded", $"grant_type=password&username={user}%40tr.com&scope=trapi&client_id={appKey}&password={password}", ParameterType.RequestBody);
response = client.Execute(request);
However, when I run the previous code I get the following response.Content:
"{\"error\":\"access_denied\" ,\"error_description\":\"Invalid username or password.\" } "
This seems strange to me, because I am sure that my credentials are correct (I use them almost everyday when I run the reuters desktop application)
Please, could you help me to identify what I am doing wrong?
Thanks in advance.