Ask Your Question

Revision history [back]

401 means Unauthorized Access. It means that the credentials you are passing to access the resource are not valid or if they are then the signature that the API call requires is invalid. Please see in detail what the API call needs, see these few things

  1. The format of API call i,e. GET, POST, PUT etc
  2. How you are passing authentication credentials, i,e are you using basic auth or any Oauth mechanism
  3. See required Parameters, whether it requires parameters in URL or in headers or in JSON request

If you properly pass on this information it would return a proper response. Otherwise, share screenshots or details mentioning the situation.

401 means Unauthorized Access. It means that the credentials you are passing to access the resource are not valid or if they are then the signature that the API call requires is invalid. Please see in detail what the API call needs, see these few things

  1. The format of API call i,e. GET, POST, PUT etc
  2. How you are passing authentication credentials, i,e are you using basic auth or any Oauth mechanism
  3. See required Parameters, whether it requires parameters in URL or in headers or in JSON request

If you properly pass on this information it would return a proper response. Otherwise, share screenshots or details mentioning the situation.

EDITED:

To debug authentication problems, determine which chef-client is attempting to authenticate. This is often found in the log messages for that chef-client. Debug logging can be enabled on a chef-client using the following command:

$ chef-client -l debug

When debug logging is enabled, a log entry will look like the following:

`[Wed, 05 Oct 2011 22:05:35 +0000] DEBUG: Signing the request as NODE_NAME`
If the authentication request occurs during the initial chef-client run, the issue is most likely with the private key.

If the authentication is happening on the node, there are a number of common causes:

The client.pem file is incorrect. This can be fixed by deleting the client.pem file and re-running the chef-client. When the chef-client re-runs, it will re-attempt to register with the Chef server and generate the correct key.
A node_name is different from the one used during the initial chef-client run. This can happen for a number of reasons. For example, if the client.rb file does not specify the correct node name and the host name has recently changed. This issue can be resolved by explicitly setting the node name in the client.rb file or by using the -N option for the chef-client executable.
The system clock has drifted from the actual time by more than 15 minutes. This can be fixed by syncing the clock with an Network Time Protocol (NTP) server.

Quoted from this link.