Show
Setup
Login as admin in a site using https .
Go to Site administration ► Users ► Permissions ► Define roles.
Click to Edit the role Authenticated user .
In the Capability section, Allow the capability "moodle/webservice:createtoken".
Now go to Site administration ► Mobile app ► Mobile settings.
Enable "Enable web services for mobile devices".
Now go to "Site administration ► Users ► Accounts ► Add a new user" and create a new user in the site (not an admin user).
Test create a token manually
As admin, go to "Site administration ► Plugins ► Web services ► Manage tokens" and create a Token in the mobile app service for the user created in the step 7 of the previous section.
Open the following URL in a browser (or you can do a CURL request if you prefer). Please notice you need to replace the site URL with yours, and set the username and password with the user created before.
https://MYSITE/login/token.php?username=user67749&password=test&service=moodle_mobile_app
Check that the response includes a privatetoken and is not null.
Test reset tokens
As admin, go to "Site administration ► Plugins ► Web services ► Manage tokens" and delete the token created in the step 1 of the previous section.
Open the following URL in a browser (or you can do a CURL request if you prefer). Please notice you need to replace the site URL with yours, and set the username and password with the user created before.
https://MYSITE/login/token.php?username=user67749&password=test&service=moodle_mobile_app
Check that the response includes a privatetoken and is not null.
Login with the user used in the previous step.
Click your image in the top right and go to Preferences ► Security keys.
Click "Reset" at the right of the token and confirm the action.
Repeat step 2.
Check that the response includes a privatetoken and is not null.