Execution of an API call fails with a 403 error indicating invalid credentials or a locked account, despite the credentials being confirmed as correct (e.g., successful login via the Web UI).
Command executed:
curl -k -u "admin:@password" GET "https://localhost/api/v1/firewall/profiles?resource_type=FirewallSessionTimerProfile"
Output received:
{
"module_name": "common-services",
"error_message": "The credentials were incorrect or the account specified has been locked.",
"error_code": 403
}
VMware NSX
The error occurs because the password contains a special character (such as @) and is being passed directly inline within the curl command (-u "admin:@password"). When special characters are included in the command line, the shell or curl can misinterpret the password string. This causes the credentials passed to the server to be incorrect, leading to an authentication failure, even though the actual password is valid.
To resolve this issue and prevent parsing errors with special characters, remove the password from the curl command syntax and allow the command line interface to prompt for it interactively.
Steps to resolve:
Modify your curl command to only include the username in the -u parameter:
curl -k -u "admin" -H "Content-Type: application/json" -X POST https://localhost/api/v1/service-configs -d @helloworld2.json
Execute the command.
The command line interface will pause and securely prompt you to enter the password:
Enter host password for user 'admin':
Type your password (including any special characters) and press Enter. The API call will now authenticate and execute successfully.