---
title: /auth/login
slug: authlogin
docTags: 
createdAt: 2023-07-20T14:59:31.346Z
---

{
  "id": "cj665Ry9RNohtw_27iuwf",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "/auth/login",
    "name": "/auth/login",
    "description": "Caso login seja efetuado com sucesso recebe um token de acesso a api.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "customType": "LoginDto",
          "schema": [
            {
              "name": "email",
              "kind": "required",
              "type": "string",
              "description": "E-mail do usuário da api"
            },
            {
              "name": "password",
              "kind": "required",
              "type": "string",
              "description": "Senha do usuário da api"
            }
          ],
          "modelRef": "#/components/schemas/LoginDto",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "Login realizado com sucesso",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "customType": "ConfigurationUserTokensDto",
            "schema": [
              {
                "name": "access_token",
                "kind": "required",
                "type": "string",
                "description": "Token de acesso a api",
                "example": "APP_OCK-abcd1234-abcd-1234-abcd-abcd1234efgh"
              },
              {
                "name": "access_token_expire_at",
                "kind": "required",
                "type": "string<date-time>",
                "description": "Data de expiração do token de acesso"
              },
              {
                "name": "refresh_token",
                "kind": "required",
                "type": "string",
                "description": "Token para atualizar o acesso a api",
                "example": "RFT-abcd1234-abcd-1234-abcd-abcd1234efgh"
              }
            ],
            "modelRef": "#/components/schemas/ConfigurationUserTokensDto",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "JT_poOE0BnFSoWD9WqcqD",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url /auth/login \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"email\": \"\",\n     \"password\": \"\"\n     }'"
        },
        {
          "id": "dlUkhSvkhfkYyMhg28bKt",
          "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({\n   \"email\": \"\",\n   \"password\": \"\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"/auth/login\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "zjZrY3qqmw7DZchRCh_Nc",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"/auth/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({\n   \"email\": \"\",\n   \"password\": \"\"\n})\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "GQnn6oLc7Lf9IBM4QVngr",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"/auth/login\"\n\npayload = json.dumps({\n   \"email\": \"\",\n   \"password\": \"\"\n})\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": "JT_poOE0BnFSoWD9WqcqD"
    },
    "results": {
      "languages": [
        {
          "id": "Rp_EgY0tWUqZqPSDbpnWO",
          "language": "201",
          "code": "// Login realizado com sucesso\n{\n  \"access_token\": \"APP_OCK-abcd1234-abcd-1234-abcd-abcd1234efgh\",\n  \"access_token_expire_at\": \"\",\n  \"refresh_token\": \"RFT-abcd1234-abcd-1234-abcd-abcd1234efgh\"\n}"
        }
      ],
      "selectedLanguageId": "Rp_EgY0tWUqZqPSDbpnWO"
    }
  },
  "children": [
    {
      "id": "L7MIClM_Xh2GNIE1OqcxV",
      "type": "paragraph",
      "children": [
        {
          "text": "Caso login seja efetuado com sucesso recebe um token de acesso a api."
        }
      ]
    }
  ]
}