I've verified that the getUser function is called every time with "domain344", "client1234" 2x and "www-data", after following the example and passing domain344 as CURRENT_USER env into initSession().

However, when I go to the website and try to install an application, I get "Malformed field_location:" and "_errors_nodomains" in the install_error_log, and the website says:
"Error
Malformed field_location:
No domains are available for this account. Use the hosting control panel to add a domain before installing an application."