I think that once you have verified the authentication parameters, you just need to do something like:
// log in
$USER = get_complete_user_data('id', $localuser->id, $localuser->mnethostid);
complete_user_login($USER);
(around line 34 in /auth/mnet/land.php) get_complete_user_data can look up users using different fields, and you'll probably want to skip the last parameter.
/auth/mnet/land.php is the file that you get redirected to when you want to log into a remote Moodle using Moodle Networks, and it causes the user to be logged in automatically.
Security and privacy
Integration with external system users?
This discussion has been locked so you can no longer reply to it.