Found plenty of detail about using REST API, but not how to troubleshoot a failing login. I've verified the credentials and UI login works fine with these credentials so I'm confused why it's not working:
AUTH64=$(printf 'user@domain.com:************' | base64)
curl -k -X POST https://vcenter.some.domain.com/api/session -H "Authorization: Basic ${AUTH64}"
{"error_type":"UNAUTHENTICATED","messages":[{"args":[],"default_message":"Authentication required.","id":"com.vmware.vapi.endpoint.method.authentication.required"}]}
So far I've tried 'username', 'domain/username' and 'username@domain'. I'm using FreeIPA as LDAP backend and using the local admin user doesn't work either. What on earth am I doing wrong?!
Silly error in the end that took way too much time: echo includes a line feed which base64 happily includes in the parsed string. Using printf is a better option here (one could also use echo with a flag to inhibit the line feed). The example above was amended with printf.
For clarity, I'm trying to use the new API (/api/session) rather than the old one (/vmware/cis/session).
Edited the original post. I got caught out by a simple line feed...
For clarity, I'm trying to use the new API (/api/session) rather than the old one (/vmware/cis/session).
Edited the original post. I got caught out by a simple line feed...
