2

I have configured moodle on local host and I am trying to generate the token for authentication.

I have already followed these steps :

== Configuring Moodle for using the application ==

  • Administration -> Plugins -> Web Services -> External Services -> Enable mobile web service

  • Administration -> Plugins -> Web Services -> Protocols -> Enable REST

  • Administration -> Users -> Permission -> Define roles -> Edit the Authenticated user role -> Allow webservice/rest:use

  • Administration -> Security -> Site policies -> Change the server upload limit. It can't be Server limit. There is a bug in Moodle Web Services

URL :- http://localhost/moodle/login/token.php?username=admin&password=Turbo@000&service=local_mobile

Response :- 
{
    "error": "Web service is not available (it doesn't exist or might be disabled)",
    "stacktrace": null,
    "debuginfo": null,
    "reproductionlink": null
}
arieljannai
  • 2,124
  • 3
  • 19
  • 39
Badal Sharma
  • 79
  • 1
  • 4

3 Answers3

4

check the short name of the service, you can find it here: Site administration -> Plugins -> Web services -> External services Click edit for the target service and make sure that it's enabled and the name you use is correct

Victor Bashurov
  • 370
  • 3
  • 12
1

Your service short name is incorrect . You should define new external service or you can use one of existing services like moodle_mobile_app . Try this:

http://localhost/moodle/login/token.php?username=admin&password=Turbo@000&service=moodle_mobile_app

AminFarajzadeh
  • 346
  • 5
  • 17
0

For me the problem was that my service had no short name! I actually hate this moodle API. There is no clear document to show you straight forward how to do this stuff.

Ali Samie
  • 145
  • 2
  • 11