Updated to take the authentication domain from the settings