I’m not able to authenticate to get LtpaToken2 and JSESSIONID. Here is the code:
string url = "http://maximo.local/maximo/"; //http://maximo.local/maximo/j_security_check?j_username=admin&j_password=admin
string uri = "oslc/login";
using (HttpClient client = new HttpClient())
{
client.BaseAddress = new Uri(url);
string username = "admin";
string password = "admin";
client.DefaultRequestHeaders.Add($"Authorization", $"Basic {Base64Encode($"{username}:{password}")}");
string paramentros = "";
var response = client.PostAsync(uri, new StringContent(paramentros, Encoding.UTF8, "application/json")).Result;
if (response.IsSuccessStatusCode)
{
var jsonString = await response.Content.ReadAsStringAsync();
}
What could be wrong?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Does your Maximo store the username and password?
Native Authentication in Maximo uses a header to log in through the rest api, but it’s not as you have it.
So you want to have the header maxauth and then the value is the base64 encoded userid:password.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0