Implemented first version of authentication.
Created an authenticate_client function