autologin from website

autologin from website

by Ilaria Di Russo -
Number of replies: 4

Hi, I need help. How to generate autologin to Moodle from an external website (base on  .net  e web with json). ? Thanks

Average of ratings: -
In reply to Ilaria Di Russo

Re: autologin from website

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

If you have the username and password, you can just "fake" Moodle's login form. Something like this...

<form action="http://your.site/moodle/login/index.php" method="post">
    <input type="hidden" name="username" value="USERNAME" />
    <input type="hidden" name="password" value="PASSWORD" />
    <input type="submit" value="Click to go to Moodle" />
</form>

Generate this form in your website sticking in the correct values for the Moodle path, username and password. 

If you don't have the password (and in a secure application you should not) then you need to implement some form of proper SSO and this isn't trivial. 

Average of ratings: Useful (1)
In reply to Howard Miller

Re: autologin from website

by Ilaria Di Russo -

Thanks a lot. Will try as you suggested. 

In reply to Ilaria Di Russo

Re: autologin from website

by Albert Ramsbottom -

As Howard states, the only way to do this properly would be to have some form of SSO such as CAS.

Make sure you have https at both ends, otherwise you will be sending your admin details in clear text over the web

Cheers