We can access Moodle outside the Moodle (without login) by passing token in the URL.
For example :
http://localhost/Moodle_new/webservice/pluginfile.php/26/qtype_match/subquestion/17/5/6/PineApple.jpg?token=6yhg9331af9d9284abb36cyjh0c67114a
If token is not be passed into the URL, then it redirects to Moodle’s login screen.