HTTP 401 error "Authorization Required"


A REST request returns response code 401 and the response body contains the following text string:

Authorization Required

This response means that no valid session was found for the session token passed to the API.

Solution 1

The user attempting the request is not logged into the REST API for one of the following reasons:

  • The user has not yet logged in.

  • The user logged in but the session has expired.

Log in to the REST API.
Solution 2

The user attempting the request is not logged in to the REST API because the user did not pass the correct session cookie to the API. Typically, incorrect session cookies are not a cause when accessing the REST API through a browser because the browser automatically handles the session cookie.

  1. Ensure that you save the session cookie returned from the login request.
  2. Ensure that you pass the same cookie back to the switch with every REST API request, including the request to log out.