---
title: MFA Login
slug: kronpam-api-collection-350/mfa-login
docTags: 
createdAt: 2024-07-22T09:58:47.222Z
---

{
  "id": "Ou3H_HCu5SBgJa0LtTc1m",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "{{url}}/aioc-rest-web/rest/login/validateOtp",
    "name": "",
    "description": "<h3>Overview</h3>\n<p>If OTP is enabled and the necessary configurations have been set up, the account attempting to log into KRON PAM must possess a 6-digit Offline Token. This can be accessed via the KRON PAM mobile application. It's assumed that if you have OTP set up, you are familiar with these steps. For more detailed instructions, <a href=\"https://docs.krontech.com/getting-started-guide-newui/multi-factor-authentication-mfa\" target=\"_blank\">click here.</a></p>\n<p><strong>IMPORTANT:</strong> THIS METHOD SHOULD BE USED IF AND ONLY IF THE USER OR USER GROUP HAS OTP (One-Time Password) ENABLED.</p>\n<p><em>You need to enter your 6 digits into the method's body.</em></p>",
    "contentType": "application/json",
    "request": {
      "headerParameters": [
        {
          "name": "X-XSRF-TOKEN",
          "description": "",
          "default": "{{csrftoken}}",
          "value": "{{csrftoken}}",
          "type": "string"
        }
      ],
      "queryParameters": [],
      "pathParameters": [
        {
          "name": "url",
          "description": "",
          "default": "url",
          "value": "url",
          "type": "string"
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "description": "",
          "default": "{\r\n         \"token\" : \"702635\" \r\n}",
          "value": "{\r\n         \"token\" : \"702635\" \r\n}",
          "type": "object"
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "MFA Login",
        "jsonExample": ""
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "jKLxPMcmDUAf_qk9WKjuZ",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/login/validateOtp \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --header 'x-xsrf-token: {{csrftoken}}' \\\n     --data '\"{\\r\\n         \\\"token\\\" : \\\"702635\\\" \\r\\n}\"'"
        },
        {
          "id": "g5VC8vntsFQ7nPt7G72QG",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"x-xsrf-token\", \"{{csrftoken}}\");\n\nvar raw = JSON.stringify(\"{\\r\\n         \\\"token\\\" : \\\"702635\\\" \\r\\n}\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"{{url}}/aioc-rest-web/rest/login/validateOtp\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "xorcditSprsIR9v-32PtK",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/login/validateOtp\")\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[\"x-xsrf-token\"] = \"{{csrftoken}}\"\nrequest.body = JSON.dump(\"{\\r\\n         \\\"token\\\" : \\\"702635\\\" \\r\\n}\")\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "0_961z8bYtGLJTC9heHOv",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/aioc-rest-web/rest/login/validateOtp\"\n\npayload = json.dumps(\"{\\r\\n         \\\"token\\\" : \\\"702635\\\" \\r\\n}\")\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'x-xsrf-token': '{{csrftoken}}'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "jKLxPMcmDUAf_qk9WKjuZ"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// MFA Login\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}