LMSouq
moodle-core Open

Is there a way for Moodle Single-Sign-On from a Laravel Application?

ND
Ndeya Taapopi
1 month ago
3 views
Problem Description
I'm setting up a single-sign-on feature for moodle from a laravel website. 1. User accesses the laravel site 2. User logs in 3. User clicks a link to Moodle 4. The user is automatically logged into Moodle without having to reenter their username and password. If the user bookmarks or directly accesses Moodle, they can still login directly there with their username and password. I have tried to user php cURL to post username and password to the login url. $url = "http://moodle.site.com.na/sso/login/index.php"; $postData = array('username' => $username, 'password' => $password); try { $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); } catch(Exception $e){ dd($e); } return $response;​ When the single-sign-on is successful, then the user should be automatically logged into moodle site without having to re-enter their username and password.

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