0

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?

dwater2
  • 5
  • 3
  • See following : https://www.ibm.com/support/pages/configuring-maximo-authentication – jdweng Nov 11 '20 at 18:46
  • 1
    What is the error you are getting? This appears correct, though I don't actually know c#. My first thought would be your server isn't actually set up for LDAP/app server authentication and therefore you need to be using a different header, but the error message usually says as much. – Dex Nov 12 '20 at 11:18

1 Answers1

0

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.

Paul
  • 16