No, this is not the legal way to track someone's location. This is an unethical way to track someone's location. Also, it will be a punishable offense in the regulations of the laws. Hence these third-party applications did not work publicly. Also, you can use the VPN connection to use these types of applications. Also, Hackers and spammers may use these applications to track someone easily.
Read More - https://allsavvy.net/how-to-track-someone-on-google-maps