Evident Monitoring API calls fail with error code 401 (Access Denied)

Evident Monitoring API calls fail with error code 401 (Access Denied)

0
Created On 09/26/18 13:45 PM - Last Modified 07/19/22 23:08 PM


Symptom


Symptoms

Running the script will result with error code 401.  For example, the following is the error generated with Ruby SDK:

 

/Users/esp-user/.rvm/gems/ruby-2.3.0/gems/activeresource-4.0.0/lib/active_resource/connection.rb:140:in `handle_response': Failed.  Response code = 401.  Response message = Access Denied. (ActiveResource::UnauthorizedAccess)
from /Users/esp-user/.rvm/gems/ruby-2.3.0/gems/activeresource-4.0.0/lib/active_resource/connection.rb:123:in `request'
from /Users/esp-user/.rvm/gems/ruby-2.3.0/gems/api-auth-2.0.1/lib/api_auth/railtie.rb:87:in `request_with_auth'
from /Users/esp-user/.rvm/gems/ruby-2.3.0/gems/activeresource-4.0.0/lib/active_resource/connection.rb:100:in `block in put'
from /Users/esp-user/.rvm/gems/ruby-2.3.0/gems/activeresource-4.0.0/lib/active_resource/connection.rb:216:in `with_auth'
from /Users/esp-user/.rvm/gems/ruby-2.3.0/gems/activeresource-4.0.0/lib/active_resource/connection.rb:100:in `put'
from /Users/esp-user/.rvm/gems/ruby-2.3.0/gems/esp_sdk-2.7.0/lib/esp/resources/resource.rb:31:in `where'
from test1.rb:15:in `<main>'

 

Note: depending on the script language, the error may appear differently.

Diagnosis

API access key ID or secret key

Create a new set of API access key and secret key and use that set to make the API call. 

 

Lack of Permission

Try a simple API call such as return all Users.  Ruby SDK Example:

require "esp_sdk"
ESP.access_key_id = <access_key_id>
ESP.secret_access_key = <secret_access_key>
users = ESP::User.all

If you are able to run a simple call, then it is likely your user does not have sufficient permission to access certain resources.  If possible, try to access the same resources in Evident Monitoring Web UI.

 

Oudated SDK version

Check the following GitHub repositories and make sure you are running the latest SDK version:

Issues with Other Libraries

Check if your code contains references to any external libraries that may conflict with Evident Monitoring SDK, e.g. ActiveResources

 

Request Header

If you are not using an Evident Monitoring SDK, review your request header and make sure formatting, encoding, and encryption are all performed correctly. Check the following examples:

 

Unsupported Operating System

If you are using an unsupported operating system (e.g. Debian Linux), try running the same code on Amazon Linux.



Resolution


API access key ID or secret key

Create and use a new set of API key

 

Lack Permission

Contact an Evident Monitoring Manager to provide you with additional permissions needed to access the specific resources.  

 

Oudated SDK version

Upgrade your Evident Monitoring SDK

 

Issues with Other Libraries

Remove references to conflicting libraries 

 

Request Header

Update the request header to the expected format.  Make sure encoding and encryption are performed accurately.

 

Unsupported Operating System

Run the code on a supported operating system (e.g. Amazon Linux)



Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA10g000000ClndCAC&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail