{"id":19592068,"url":"https://github.com/catalyst/moodle-tool_token","last_synced_at":"2025-04-23T04:53:35.092Z","repository":{"id":38466626,"uuid":"350936993","full_name":"catalyst/moodle-tool_token","owner":"catalyst","description":"An admin tool provides a web service for generating Moodle web service tokens. It conceptually works the same way as /login/token.php, but via web services. n","archived":false,"fork":false,"pushed_at":"2024-11-20T23:20:57.000Z","size":77,"stargazers_count":5,"open_issues_count":2,"forks_count":1,"subscribers_count":6,"default_branch":"MOODLE_404_STABLE","last_synced_at":"2025-04-23T04:53:30.133Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://moodle.org/plugins/tool_token","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/catalyst.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-24T03:42:08.000Z","updated_at":"2025-03-03T03:40:52.000Z","dependencies_parsed_at":"2023-02-02T21:46:18.390Z","dependency_job_id":null,"html_url":"https://github.com/catalyst/moodle-tool_token","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalyst%2Fmoodle-tool_token","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalyst%2Fmoodle-tool_token/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalyst%2Fmoodle-tool_token/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalyst%2Fmoodle-tool_token/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/catalyst","download_url":"https://codeload.github.com/catalyst/moodle-tool_token/tar.gz/refs/heads/MOODLE_404_STABLE","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250372946,"owners_count":21419722,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T08:32:59.341Z","updated_at":"2025-04-23T04:53:35.086Z","avatar_url":"https://github.com/catalyst.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/catalyst/moodle-tool_token/ci.yml?branch=MOODLE_404_STABLE)\n\n# Token generator #\n\nAn admin tool provides a web service for generating Moodle web service tokens. It conceptually works the same way as /login/token.php, but via web services. See https://docs.moodle.org/dev/Creating_a_web_service_client#How_to_get_a_user_token\n\n## Branches ##\n\nThe following maps the plugin version to use depending on your Moodle version.\n\n| Moodle version   | Branch            |\n|------------------|-------------------|\n| Moodle 4.4 +     | MOODLE_404_STABLE |\n| Moodle 3.9 - 4.1 | master            |\n\n\n\n## Installation ##\n\nAdd the plugin to /admin/tool/token/\n\nRun the Moodle upgrade.\n\n## Configuration ##\n\nThe plugin has following settings.\n\n* Token lifetime - allows configuring max lifetime for the generated tokens. Once generated tokens will be valid for configured time.\n* Enabled auth methods - allows configuring auth methods to filter user by. Token can be generated for users with enabled auth methods only.\n* Enabled user fields - allows configuring user fields for matching users, including unique custom user profile fields. These fields could be used in a web service call to match users in Moodle. Note: 'id' filed is always enabled.\n* Enabled services - allows whitelisting only specific services for generating tokens using this plugin. Token can be generated for enabled services only.\n\n## Usage ##\n\nYou need to configure your Moodle for using Web services. See documentation https://docs.moodle.org/310/en/Web_services\n\nOn the installation the plugin will automatically create **Token\nGenerator Service**, but it will be disabled by default. You should enable it and create a token for that service. Then you can call tool_token_get_token function baked to that service.\n\n###  Example of GET request ###\nhttps://example.local/webservice/rest/server.php?wstoken=r572f821c120ad147b244a939fdd7324\u0026wsfunction=tool_token_get_token\u0026moodlewsrestformat=json\u0026idtype=username\u0026idvalue=student\u0026service=test_service\n\nResponse on success:\n\n{ \"userid\": 12, \"token\": \"c27319f9f198028db79a5d955c01d6cb\", \"validuntil\": 0 }\n\n## License ##\n\n2021 Catalyst IT\n\nThis program is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free Software\nFoundation, either version 3 of the License, or (at your option) any later\nversion.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\nPARTICULAR PURPOSE.  See the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with\nthis program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatalyst%2Fmoodle-tool_token","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatalyst%2Fmoodle-tool_token","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatalyst%2Fmoodle-tool_token/lists"}