---
title: Login
slug: kron-pam-api-collection-3-7-0
docTags: 
createdAt: 2025-05-08T12:58:22.242Z
---

{
  "id": "bB1FQXr2a2oQOWTwO4orT",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "{{url}}/aioc-rest-web/rest/login",
    "name": "",
    "description": "<p>The login method is the primary gateway to the KRON PAM system. Before accessing any other functionalities or methods, users must authenticate themselves using this method by providing a username and password.</p>\n<p>Successfully logging in provides the user with a session ID, which is essential for subsequent interactions with the system.</p>\n<p><strong>Note:</strong><br>\nIf you have enabled One-Time Password (OTP) for Multi-Factor Authentication (MFA), you must enter your 6-digit code after the initial login.</p>\n<p><strong>Request Headers:</strong></p>\n<ul>\n<li><code>Content-Type: application/json</code></li>\n</ul>\n<p><strong>Response Cookies:</strong><br>\nUpon a successful login, the server will include several cookies in the response. These cookies are critical for maintaining the session and ensuring secure communication in subsequent requests. Ensure that your client (or cookie jar) is configured to handle the following cookies:</p>\n<ul>\n<li>\n<p><strong>JSessionID:</strong><br>\nUsed to manage the session state for the authenticated user.</p>\n</li>\n<li>\n<p><strong>XSRF-TOKEN (also referred to as XRFS Token):</strong><br>\nThis token is provided to protect against Cross-Site Request Forgery (CSRF) attacks. It must be included in the <code>X-XSRF-TOKEN</code> header in all follow-up requests.</p>\n</li>\n<li>\n<p><strong>Netright ID:</strong><br>\nAn additional identifier necessary for session management and authorization.</p>\n</li>\n</ul>\n<p><em>Tip:</em> Make sure that your cookie storage or session handling mechanism supports the size requirements for these cookies. Properly retaining these cookies is essential for secure and seamless interaction with the KRON PAM system.</p>\n<hr>\n<p><strong>Workflow Summary:</strong></p>\n<ol>\n<li>\n<p><strong>Authentication:</strong><br>\nSend a POST request with your credentials (username and password) to the login endpoint.</p>\n</li>\n<li>\n<p><strong>Cookie Storage:</strong><br>\nOn successful authentication, extract and store the <code>JSessionID</code>, <code>XSRF-TOKEN</code>, and <code>Netright ID</code> cookies. These cookies must be retained and sent with all subsequent requests.</p>\n</li>\n<li>\n<p><strong>OTP Verification (if enabled):</strong><br>\nIf MFA is active, a follow-up OTP validation request must be sent with the additional 6-digit code.</p>\n</li>\n<li>\n<p><strong>Subsequent Requests:</strong><br>\nInclude the stored cookies (especially the <code>XSRF-TOKEN</code> via the <code>X-XSRF-TOKEN</code> header) in all further interactions with the system to ensure session integrity and security.</p>\n</li>\n</ol>",
    "contentType": "application/json",
    "request": {
      "headerParameters": [
        {
          "name": "Content-Type",
          "description": "",
          "default": "application/json",
          "value": "application/json",
          "type": "string"
        }
      ],
      "queryParameters": [],
      "pathParameters": [
        {
          "name": "url",
          "description": "",
          "default": "url",
          "value": "url",
          "type": "string"
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "description": "",
          "default": "{\"username\":\"{{TestUserName}}\",\"password\":\"{{TestUserPassword}}\"}",
          "value": "{\"username\":\"{{TestUserName}}\",\"password\":\"{{TestUserPassword}}\"}",
          "type": "object"
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Login",
        "jsonExample": "{\n    \"sessionId\": \"a8aa28c1-bd5a-4ea3-9490-47cfee4b52ca\"\n}"
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "fQklqecv1v-bcv8v2NEIO",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/login \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '\"{\\\"username\\\":\\\"{{TestUserName}}\\\",\\\"password\\\":\\\"{{TestUserPassword}}\\\"}\"'"
        },
        {
          "id": "zYAqL4XPiydwMG2Vi-utW",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify(\"{\\\"username\\\":\\\"{{TestUserName}}\\\",\\\"password\\\":\\\"{{TestUserPassword}}\\\"}\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"{{url}}/aioc-rest-web/rest/login\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "-M3mYJj7zFpFwI0nRRy3e",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/login\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump(\"{\\\"username\\\":\\\"{{TestUserName}}\\\",\\\"password\\\":\\\"{{TestUserPassword}}\\\"}\")\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "CvXzLt6rzwf2m72V-wrOw",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/aioc-rest-web/rest/login\"\n\npayload = json.dumps(\"{\\\"username\\\":\\\"{{TestUserName}}\\\",\\\"password\\\":\\\"{{TestUserPassword}}\\\"}\")\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "fQklqecv1v-bcv8v2NEIO"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "{\n    \"sessionId\": \"a8aa28c1-bd5a-4ea3-9490-47cfee4b52ca\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}