Bulk create users’ token and private token

Source: https://moodle.org/mod/forum/discuss.php?d=430305

Expected result: token and privatetoken to be generated in the database (mdl_external_tokens). Use ‘moodle_mobile_app’ as the service, because this step is done to facilitate the bulk login of moodle app using terminal (adb)

Prerequisites:

  • Active installation of Moodle
  • Users’ username and password in plaintext
  • Terminal

Type / paste the following into terminal: (adjust the text in bold)

curl https://MOODLESITE/login/token.php?username=USERNAME&password=PASSWORD&service=moodle_mobile_app

You should get response something like this:

{token:4ed876sd87g6d8f7g89fsg6987dfh78d}

Check in the database, table mdl_external_tokens if that user is indeed getting the token.

Leave a Reply

Your email address will not be published. Required fields are marked *