Updated the http client code to avoid round trips for auth.