This error generally arises when the web services are not properly added to Moodle or the user associated with the web services do not have capabilities to enroll/unenroll in the course or to create/delete the user.

Please check,

In Moodle;
1) Check if all the functions are added to the External Services as mentioned in the documentation.
2) Check if Rest protocol is enabled in Manage protocols.
3) Check if Token that you have generated is still present in Moodle.
4) Check if you have enabled 'Web Services' in advanced features.
5) Check if Manual enrollment is enabled for all courses in your Moodle site.
6) Check if the associated user in External service is admin of your Moodle site. The token key has to be generated with the admin as the associated user.