Authenticate with username and apiKey

Make a POST request with a username and API to generate a JSON Web Token (JWT) to use to authenticate in Control Room APIs.

Prerequisites

  • A user with the Generate API-Key role.
    Note: The Generate API-Key feature requires the creation of a custom role, see Enterprise 11: Create and assign API key generation role.
  • Generate API-Key.
  • Valid username and apiKey for your Control Room
  • REST client or access to Automation Anywhere Swagger files for your Control Room.
  • URL: http://<your_control_room_url>/v1/authentication
  • Method: POST

Using a Generate API-Key enables users to create tokens without the need to gather user credentials.

Procedure

  1. Enter the following parameters in the request body.
    Request body:
    Note: The API-Key is a 40 character string. Make sure you replace any escape character '\' with '\\' in the API-Key.
    {
    "username": "jdoe",
    "apiKey":  "3/.Z)8:P`+yVJq . . . *fTk.i>|VOOl&:"
    }
    
    Depending on how your Control Room is configured, a domain could be require with the username.
    {
    "username": "your-domain\\jdoe",
    "apiKey":  "3/.Z)8:P`+yVJq . . . *fTk.i>|VOOl&:"
    }
    
    Note: The API-Key Duration can be configured by an Admin user from the ADMINISTRATION > Settings > General tab.
  2. Send the request.
    • In a REST Client, click SEND.
    • In the Swagger interface, click Execute.
    Response body:
    Note:
    Note: The JWT is a 703 character string.
    {
      "token": "eyJhbGciOiJSUzUxMiJ9.eyJzdWIiOiIxIiwiY2xpZW50VHlwZSI6IldFQiIsImxpY2Vuc2VzIjpbXSwiYW5hbHl0aWNzTGljZW5zZXNQdXJjaGFzZWQiOnsiQW5hbHl0aWNzQ2xpZW50Ijp0cnVlLCJBbmFseXRpY3NBUEkiOnRydWV9LCJpYXQiOjE1NzMxMDc4NzMsImV4cCI6MTU3MzEwOTA3MywiaXNzIjoiQXV0b21hdGlvbkFueXdoZXJlIiwibmFub1RpbWUiOjM2NTc1NjI0OTQ2MzE2MDAsImNzcmZUb2tlbiI6ImNiZjgwZWNkZmU5YmUwYzViOGI2MDk3NmU0ZTI2MTNiIn0.rGYxbS5kKUTxtZhYtRSXpmIHwbf3IwLBIKDEA7odG5uGVAjD55Tv05bYdARx_3-tl1CBg_cDGbwj5FvaBt9u5xKu5W5j3Nur6x3PF62NeB3ZIdxiUPaFBU0Br84mPJMD4_EpwBfbeSVOMH6ngiLtJYhIOtJa0kp4pAAm3mvkuOUELtH8lf3pQf-2Ose2fUAaebDkqiH13SUF1TONAjUQv6Ef_uY0wgq9SjZwKHg9SKUhX3S8PXAJne_ih2QnN8nUE1SXGlkC04eoIvyWpFkM963XEjptc2uvwtVn42MdA4Nd1opD5yijEl9VM92Fe1sPb6_T5-oV-U1Iw0JHiX2-Ug",
      "user": {
        "id": 9,
        "email": "a@a.com",
        "username": "jdoe",
        "domain": null,
        "firstName": "",
        "lastName": "",
        "version": 9,
        "principalId": 9,
        "deleted": false,
        "roles": [
          {
            "name": "API_Key_Generation",
            "id": 23,
            "version": 0
          },
          {
            "name": "AAE_Basic",
            "id": 2,
            "version": 0
          },
          {
            "name": "Docrole1",
            "id": 18,
            "version": 0
          },
          {
            "name": "AAE_Meta Bot Designer",
            "id": 13,
            "version": 0
          }
        ],
        "sysAssignedRoles": [],
        "groupNames": [],
        "permissions": [
    
    	. . .
    
        ],
        "licenseFeatures": [
          "RUNTIME"
        ],
        "emailVerified": true,
        "passwordSet": true,
        "questionsSet": true,
        "enableAutoLogin": false,
        "disabled": false,
        "clientRegistered": false,
        "description": "",
        "createdBy": 1,
        "createdOn": "2019-10-10T13:39:56-05:00",
        "updatedBy": 1,
        "updatedOn": "2019-10-13T02:09:38-05:00",
        "publicKey": null,
        "appType": null,
        "routingName": null,
        "appUrl": null
      }
    }