Fix authentication and service endpoint fetching

Make the client library take environment variables by default