I am trying to automatically authenticate a user but having trouble using authenticate_user_login in Moodle 3.8.3. I have tested the below code but I get the following error:
Exception - Argument 1 passed to core\session\manager::login_user() must be an instance of stdClass, boolean given, called in [dirroot]/lib/moodlelib.php on line 4632
Appreciate your help.
<?php
require('config.php');
$name="myusername";
$password="mypassword";
$dashboard = $CFG->wwwroot;
$user = authenticate_user_login($name, $password);
if(complete_user_login($user))
{
echo "login";
}
else
{
echo "not login";
}
?>