Loading
Salesforce now sends email only from verified domains. Read More

Error message "Authentication failed with status code 401" occurs when running anypoint-cli-v4 on Windows

Publish Date: Mar 2, 2024
Resolution

SYMPTOM

  • Error message "Authentication failed with status code 401" occurs when running anypoint-cli-v4 on Windows
  • Authentication mechanism is not overwritten by authentication flags present in the command

Steps to reproduce:

  1. Set username (ANYPOINT_USERNAME) and password (ANYPOINT_PASSWORD) in conf-cli or Windows environment variables
    For any information about anypoint-cli-v4 environment variables, please refer to this documentation
  2. Use a anypoint-cli-v4 command with inline client_id and client_secret.
    Below an example:
    anypoint-cli-v4 api-mgr:api:list --client_id <ANYPOINT_CLIENT_ID> --client_secret <ANYPOINT_CLIENT_SECRET> - -organization <ANYPOINT_ORG> --environment <ANYPOINT_ENV> -- host anypoint.mulesoft.com
    
    
  3. Notice that the following error occurs:
    Error: Authentication failed
    Login to https: //anypoint.mulesoft.com/accounts /api/v2/oauth2/token failed with
    status 401 - Unauthorized
    

CAUSE

Despite the value of the variables being handled correctly, the used variables are set to be:
  1. token
  2. username and password
  3. client_id an client_secret

WORKAROUND

As a workaround, unset authentication methods in conf-cli and Windows environment variables

SOLUTION

- This has been identified as a bug and a known issue has been submitted
- Please report to the known issue link
- To track a known issue, simply click the "Report" button on a Known Issue and you will be automatically subscribed to update from it, via your Trailblazer account.
- By default, you’ll receive status change email notifications for all Known Issues you’ve reported that impact you. You can control these preferences in your Trailblazer.me profile.
Knowledge Article Number

001121091

 
Loading
Salesforce Help | Article