Refactored handleAuthorize to accept a new parameter used to reply or not to the socket