I had this error "Access control exception". In Moodle administration enabling REST 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.
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.