You can use your vCenter Single Sign-On credentials with basic authentication to establish a session with a vCenter Server system.

The single-factor basic authentication is the default method to authenticate to vCenter Server. You connect to the vSphere Automation API endpoint with your vCenter Single Sign-On user name and password. The vSphere Automation endpoint checks whether the user credentials are present in vmdir, a vCenter Single Sign-On component. On success, the system returns a session identifier that you can use for subsequent API calls.

Prerequisites

To perform this task, you must have:

  • The IP address or FQDN of your vCenter Server system

  • Valid vCenter Single Sign-On user name and password

Procedure

  1. Call the Session interface with the base-64 encoded value of your vCenter Single Sign-On user name and password separated by a colon (username:password) in the authorization header.
    POST https://<vcenter_server_ip_address_or_fqdn>/api/session
    Authorization: Basic <username:password>
    

    On success (status code 201), the system returns a session identifier. For example, "a5adf880fc8e1e2944a541a4c7d74465".

  2. To authenticate subsequent API calls, pass the session identifier as a request header.
    vmware-api-session-id: <session_ID>
    Note:

    VMware encourages you to refrain from using basic authentication and adopt token-based authentication, as it is more secure and provides more flexibility.