---
title: Authenticate
slug: authenticate
icon: 🔑
createdAt: 2022-05-25T03:43:04.000Z
---

## Login

This api endpoint is used to send a post request and generate a bearer token for authentication for further access.

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://tnt-api.rpalabs.io/api/v1/auth/login",
  "name": "Overview",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "key",
        "type": "string",
        "description": "The key is used as identification to request the authentication process."
      },
      {
        "kind": "required",
        "name": "secret",
        "type": "string",
        "description": "Secret serves as a password to request the initiation of the authentication process."
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "-VH-byBwktfxWvfcti9Ep",
        "code": "{\r\n    \"type\": \"Bearer\",\r\n    \"access_token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTY2MDcyMjg0NywianRpIjoiMzkwMmVmNWUtMTA0NS00MjYyLWIxZDktMTg1MGFiMWFmY2M4IiwidHlwZSI6ImFjY2VzcyIsInN1YiI6InRlc3QiLCJuYmYiOjE2NjA3MjI4NDcsImV4cCI6MTY2MDcyNDY0N30.8EbqG7d095kpI50ilrt74sjZobBVy6oJ2LrlNUjkIek\",\r\n    \"expiry_duration\": 1800\r\n}",
        "language": "200",
        "customLabel": ""
      },
      {
        "id": "1wFSYsHo3Bfk_LlnHHc4m",
        "code": "{\r\n    \"message\": \"Password Error. Please try again with correct password\",\r\n    \"status\": 400,\r\n    \"error_code\": 3\r\n}",
        "language": "400",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "-VH-byBwktfxWvfcti9Ep"
  },
  "examples": {
    "languages": [
      {
        "id": "dPCrid-cG1BjB7mcDx8OW",
        "code": "curl --location --request POST 'https://tnt-api.rpalabs.io/api/v1/auth/login' \\\n--header 'Accept: application/json' \\\n--data-raw '{\"key\":\"string\",\"secret\":\"string\"}'",
        "language": "curl",
        "customLabel": ""
      },
      {
        "id": "Z_E1hhgTG_I8Im7oFsfOF",
        "code": "var request = require('request');\nvar options = {\n   'method': 'POST',\n   'url': 'https://tnt-api.rpalabs.io/api/v1/auth/login',\n   'headers': {\n      'Accept': 'application/json'\n   },\n   body: '{\"key\":\"string\",\"secret\":\"string\"}'\n\n};\nrequest(options, function (error, response) {\n   if (error) throw new Error(error);\n   console.log(response.body);\n});\n",
        "language": "nodejs",
        "customLabel": ""
      },
      {
        "id": "ZZsrmHZQOp3Sf-A5gbneF",
        "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Accept\", \"application/json\");\n\nvar raw = \"{\\\"key\\\":\\\"string\\\",\\\"secret\\\":\\\"string\\\"}\";\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://tnt-api.rpalabs.io/api/v1/auth/login\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));",
        "language": "javascript",
        "customLabel": ""
      },
      {
        "id": "uUvVgwcKUgwSknC4f5ZF7",
        "code": "import http.client\n\nconn = http.client.HTTPSConnection(\"tnt-api.rpalabs.io\")\npayload = \"{\\\"key\\\":\\\"string\\\",\\\"secret\\\":\\\"string\\\"}\"\nheaders = {\n   'Accept': 'application/json'\n}\nconn.request(\"POST\", \"/api/v1/auth/login\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))",
        "language": "python",
        "customLabel": ""
      },
      {
        "id": "wdcil9dNjTDvTqnwx0v_p",
        "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"https://tnt-api.rpalabs.io/api/v1/auth/login\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Accept\"] = \"application/json\"\nrequest.body = \"{\\\"key\\\":\\\"string\\\",\\\"secret\\\":\\\"string\\\"}\"\n\nresponse = https.request(request)\nputs response.read_body\n",
        "language": "ruby",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "dPCrid-cG1BjB7mcDx8OW"
  },
  "description": "This endpoint allows the user to request authentication by using the name as the key authentication and the secret as the password. The request will return data with an access token.",
  "currentNewParameter": {
    "label": "Header Parameter",
    "value": "headerParameters"
  }
}
```
:::

:::hint{type="danger"}
See the [Error Handling page](https://developers.rpalabs.io/error-handling) for troubleshooting any errors.
:::

### ✉️ Need some help?

If you encounter a problem or require assistance, please contact our support team with details regarding your request at [support@rippey.ai](support@rippey.ai)[.](support@rippey.ai) A representative will connect with you soon. 😊
