Refactored authentication on client to support multiple connections

Refactored authentication on client to support multiple connections