I had this error "Access control exception". Enabling REST in Moodle administration for the role user is in worked for me
Site administration > Users > Define roles > the role in question, for example Student > Edit > Use REST protocol, webservice/rest:use > check it
There are also SOAP, XML-RPC protocols there to try enabling.
Also maybe this role needs to get set (on the same page) to
"Context types where this role may be assigned" > System
"Create a web service token for mobile access", moodle/webservice:createmobiletoken -> checked too if this error is on mobile app.