Ride-sharing apps such as Uber and Apple-backed rival Didi Chuxing will be officially legal from November.