APIClient auth cleanup and tests