Copy a token from the Moodle app - C0D3D3V/Moodle-DL GitHub Wiki

If you are sure that the Moodle app (for Andorid or IOS) works, but none of the automatic and manual methods work to get a token, there is only one way to get a token directly from the Moodle app!

  • First you need to install the moodle desktop app. Moodle Desktop has been discontinued, but you can still download it from here: For Linux and for Windows
  • Unpack the app from the downloaded archive (on Linux you can run e.g. tar -xvzf moodledesktop-linux-64-v380.tar.gz; on windows you can use e.g. 7Zip.)
  • Now start the Moodle Desktop app in debug mode:
    • On Linux: Open a terminal in the folder where the app is located and run ./linux-x64.AppImage --debug
    • On Windows: Install the app and then open a comand line prompt and open the app in debug mode by running: "%LOCALAPPDATA%\Programs\moodledesktop\Moodle Desktop.exe" --debug (Alternatively you can specify the --debug parameter during installation :D This will open the app in debug mode right after installation)
  • Open the developer console by pressing [Control+Shift+I]
  • Go to the Network tab, as shown in the screenshot
  • Login to your moodle account like you did on your phone
  • Wait till the website is loaded and then scroll down the list of requests till you see requests starting with "server.php?" link in this image:

Screenshot_20200618_112144

  • Select one of these requests that starts with "server.php?". On the right side of the window you will now see a lot of information about the request.
  • Select the Headers tab and scroll down till you reach the Form Data section.
  • There you see the data that was send from the app to the server, one of the data is the wstoken, this is the token we need:

Screenshot_20200618_112714

  • Finally copy the wstoken and create a config.json file in a folder where you want to download the moodle files. In the config.json file paste the following:
{
    "token": "06eab0your_copied_token36a492",
    "moodle_domain": "moodle.ruhr-uni-bochum.de",
    "moodle_path": "/m/"
}

Replace the moodle_domain with the domain of your moodle server and the moodle_path with the installation path of the moodle (often it is just /).

Now you are ready to go! You can start the downloader in the folder where you created the config file.