Created an authenticate_client function