Bearer Token

Last updated on 05 January, 2024

Users are required to authenticate themselves with a bearer token before making LogicMonitor REST API v3 requests. It is a combination of multiple alpha numeric characters and is auto generated by LogicMonitor. You can use bearer token to authenticate yourself to use LogicMonitor Python and GO v3 SDK files and LogicMonitor REST API v3.

You do not have to buy special license to get a bearer token. As a LogicMonitor customer, when you buy a license for a device such as cloud device, physical device, or device of any other type, you are eligible to get a bearer token. Also, you do not need a specific role to get the token. It is unique for each user.

Unlike LMv1 token that needs a combination of current date and time to authenticate, bearer token is not dependent on date and time for authentication. It does not expire or generate a random code that you have to use for authentication. Once you get the bearer token, you have to add it to the API requests just once. Later on, LogicMonitor REST API code will reuse the token without you having to enter it every time. As a developer using LogicMonitor REST API, you need not develop authentication header or write commands to authenticate yourself. Thus, bearer token not only saves time, it also saves development efforts. 

High Security Standards of Bearer Token

Bearer token has been designed and developed to ensure customer data security. Refer to the following points to understand the security strength of bearer token:

  • Bearer token is fully visible in LogicMonitor only at the time of its generation. That’s the only chance to copy it at a secure location. Next time onwards, the token is partially masked.
  • The token is unique for each user and therefore, non-transferable. Thus, nobody can misuse it because it is partially masked and other than the rightful owner, authentication will fail.
  • Bearer token is system generated and hence, it cannot be edited.

Prerequisite

You must have the Allow Creation of API Tokens permission to access the API Tokens tab and to generate a bearer token.

Generating Bearer Token

Follow these steps to generate a bearer token:

  1. Navigate to Settings > Users & Roles > API Tokens tab > Bearer tab. A list of bearer tokens is displayed.
  2. Select add . A form to capture details is displayed. Note that by default, Bearer is selected in the Token Type drop down.
  3. Search and select your username in the User field. LogicMonitor immediately generates a token in the Token field.
  4. Select Copy to copy the token at a secure location.
    Note:
    Once generated, you have the only chance to copy it. The token is designed in such a way that later on, you can only view the token but cannot copy or edit it. This helps to ensure security of the token. 
  5. Enter details or any information related to the token in the Note field.
  6. Select Save to enable the bearer token. You can now start using the bearer token to authenticate yourself when making LogicMonitor REST API v3 requests.

To maintain secrecy of the bearer token, once you save the token, the system automatically masks some part of it with asterisks (*). Thus, even if other users view your token, they cannot use it.

Managing Bearer Token

You can manage your bearer token in few quick steps. In this section, you will learn to edit, delete, enable, and disable your token.

Editing Bearer Token Details

Although you cannot edit the bearer token, you can edit the note related to it. Follow these steps to edit the note:

  1. Navigate to Settings > Users & Roles > API Tokens tab > Bearer tab. A list of bearer tokens is displayed.
  2. Search for your bearer token.
  3. Select edit corresponding to your bearer token. A form with bearer token details is displayed.
  4. Update the note and select Save.

Deleting Bearer Token

You must consider the following points before deleting your token:

  • Once a bearer token is deleted, it cannot be retrieved.
  • All the existing API requests where you have provided the bearer token will fail after the token is deleted. 

However, if you delete your existing bearer token, you can generate a new token and resume to authenticate LogicMonitor REST API requests.

Follow these steps to delete your bearer token:

  1. Navigate to Settings > Users & Roles > API Tokens tab > Bearer tab. A list of bearer tokens is displayed.
  2. Search for your bearer token.
  3. Select delete corresponding to your bearer token. A message confirming deletion is displayed.
  4. Select Ok

Enabling and Disabling Bearer Token

On the Bearer token table, the Enabled check box for each bearer token indicates if the token is enabled or not. However, as per need, you can disable and then re-enable your bearer token.

  • Enabling bearer token – You can authenticate API requests only if the bearer token is enabled. Once a bearer token is generated, by default, it is enabled.  
  • Disabling bearer token – Clear the Enabled check box for your bearer token. All the existing API requests where you have provided the bearer token will fail after the token is disabled. 
  • Re-enabling bearer token – Select the Enabled check box for your bearer token to re-enable.
  • Viewing only enabled bearer tokens – Select the Show enabled only check box to view enabled bearer tokens. If you clear the check box, you can view both enabled and disabled bearer tokens.

Using Bearer Token on the User Interface

You can use bearer token to authenticate yourself while making API requests. You must carefully paste the bearer token in the Token field without adding blank space or extra characters.

Authenticating LogicMonitor v3 SDK Files

You must authenticate yourself before using the GO and Python v3 SDK files. You can use either an LMv1Auth or a Bearer token to authenticate.

Authenticating GO SDK using Bearer Token

The supported method in config is SetBearerToken(). By default, nil is set as the bearer token. You have to enter your bearer token to authenticate.

Example
bearerToken := “BEARER_TOKEN_VALUE”
config.SetBearerToken(&bearerToken)

Authenticating Python SDK using Bearer Token

To authenticate yourself using Bearer token, enter the following details:

configuration.auth_type = ‘Bearer’

configuration.bearer_token = ‘BEARER_TOKEN_VALUE’

In This Article