I am having issues authenticating with the vCloud Director API. I am using the following cURL commands:
curl -i -k -H "Accept:application/*+xml;version=1.5" -u '[username]@[LDAP Domain]:[password]' -X POST https://[vCloud Director IP]/api/sessions
curl --request POST --url https://[vCloud Director IP]/api/sessions --header 'accept: application/*+xml;version=5.6' --header 'authorization: Basic [encodedCredentials]
and I get a '401 Unauthorized' return code. I am trying to connect to vCloud Director v8.10.0.3879706. The account I am trying to use in the cURL command is the same one I connect to the Web Portal as, which has System Administrator privileges. I have also tried connecting as an Organisation Administrator user in a specific VDC. I am able to get output from /api/versions, so I know the API is functioning.
Can anyone help locate the cause of this 401 return code issue? It seems to me it's a problem with how I'm formatting my credentials, but I can't find the exact issue. The credentials look something like this:
exampleuser@this.ldap.domain:Test$Pass%
Thanks.
Hello
Are you logging into the API as an Administrator or as a tenant? If you are an administrator, try using [username]@SYSTEM:[password]. I don't need to specify the LDAP domain on mine, so I just use d_lee@SYSTEM for my login.
If you are logging in as a tenant, then put your Organisation Name instead of system. So in my vCD instance, our Org names are based on a customer account ID so if a customer has ID of 12345 then he would log in using username@12345.
Dave
Although this is almost a year later.
I had similar issue, which was casued by the base64 encryption on my Ubuntu.
Since you are using curl I assume that you are encrypting your login using linux as well.
Try one of the tools online, I found this one working for me: Base64 Encode - Online Tool
Ubuntu's base64 was short of '=' character at the end of the encryption.
Facing same issue with VCD 10.2. Cant login using administrator@system. Any ideas??
What tool is being used? Can you post the call code here to see? (remove sensitive data)
Hi,
It was resolved by enabling legacy API /api/sessions endpoint for provider on vCloud Director