Error after login via SAML

Error after login via SAML

by Nicola Schwery -
Number of replies: 3

Hi everybody

We have our own moodleplatform and have built an interface to another system which is responsible for user handling. The system is connected via DB connector and creates the users in moodle directly in the database by using the table mdl_user. This works fine so far.

The users should now login via SAML but unfortunatel get the following error:

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 4685

Logging in for manually created users works fine. Does anybody have an idea what this error means?
My assumption is, that we don't provied all attributes required for user creation.

The following user attributes are provided: username, auth, lastname, firstname, email, lang

Average of ratings: -
In reply to Nicola Schwery

Re: Error after login via SAML

by Nicola Schwery -
We just solved the problem.
The attribute mnethostid was 0 for all users who were transfered via the interface. By setting mnethostid = 1 the login now works.
In reply to Nicola Schwery

Re: Error after login via SAML

by Ahmed Ndaula -
Nicola,

How did you solve this? I get the following error when I try to register/login with Google (Gmail);

Exception - Argument 1 passed to core\oauth2\client::map_userinfo_to_fields() must be an instance of stdClass, null given, called in [dirroot]/lib/classes/oauth2/client.php on line 504

When I check the client.php on line 504 this is what is there and I dont know how to proceed from here;

return $this->map_userinfo_to_fields($userinfo);

Any help is higly appreciated


Thnx
In reply to Ahmed Ndaula

Re: Error after login via SAML

by Nicola Schwery -
Hi Ahmed

I checked the database and saw, that the attributes for the manually created users were not 100% identical with the automatically created ones. After some troubleshooting, I found out that in our scenario the attribute mnethostid must be set to 0 instead 1. By fixing that, we solved the problem.

I am sorry, but I don’t think I can help you with your problem. Unfortunately, I no longer have access to this Moodle platform.