Configure HMAC to support authentication for REST API endpoints.

Before you begin

Role required: admin

Plugin required: API Key and HMAC Authentication (com.glide.tokenbased_auth)

Procedure

  1. Create an HMAC configuration.
    1. Navigate to All > System Web Services > API Access Policies > HMAC Configuration.
    2. Select New.
      Note: You can also use the Default HMAC SHA256 Base64 Encoding which is created when installing the plugin.
    3. On the form, fill the fields:
      HMAC Configuration
    4. Submit the record.
  2. Create an inbound authentication profile.
    1. Navigate to All > System Web Services > API Access Policies > Inbound Authentication Profiles.
    2. Select New.
      The system displays the message What kind of authentication profile?
    3. Select Create HMAC authentication profiles.
      HMAC authentication profile
    4. On the form, fill in the fields.
      Note: The selected option has to be defined in the REST call as part of the Auth Header or Query Parameter.HMAC Profile
    5. Submit the form.
  3. Create an HMAC secret.
    1. Navigate to All > System Web Services > API Access Policies > REST API HMAC Secret.
    2. Select New.
    3. On the form, fill the fields:
    4. Submit the form.
    5. Open the record that was created.

      Find the Key ID generated by the ServiceNow AI Platform for the user.

      HMAC Key ID
      Note: You can add the Key ID that was generated during the Key ID in the Authentication Profile that was created for HMAC if you don't want to specify the Auth or Query parameter for the API call.
  4. Create a REST API access policy.
    1. Navigate to All > System Web Services > REST API Access Policies.
    2. Select New.
    3. On the form, fill in the fields.
    4. Add the API authentication profile that was created.
      HMAC Profile added to Access Policy
    5. Submit the form.
      You can send the REST API call:
      • With the x-sn-hmac-signature-256 that was generated by ServiceNow® during the API Key creation within the Header or Query parameter based on the configuration for authentication.
      • With pre-request Script with Shared Secret specified as part of the request.
      Warning: Use POST request when submitting any sensitive information to the server.