LMSouq
moodle-core Open

RESTful webservice Moodle plugin Authentication fails

US
user3031108
1 month ago
3 views
Problem Description
I am using moodle rest plugins for mobile web-services and from [this tutorial][1] I have enabled rest API and other related services as per the documentation when I try to test the web service then I got following error {"exception":"moodle_exception","errorcode":"noauthheader","message":"No Authorization header found in request sent to Moodle"} I have the cross check the moodle token even try may new tokens but no luck here is me test php code to check the web-services: $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "mydomain.com/webservice/restful/server.php/core_course_get_courses", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => '{"options": {"ids":[2]}}', CURLOPT_HTTPHEADER => array( "accept: application/json", "authorization: {4838e6771cdbfd1eefbf37b3839587d9}", "cache-control: no-cache", "content-type: application/json", ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } please let me know, what i am doing wronge thanks [1]: https://moodle.org/plugins/webservice_restful

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base