wpmu users integration with another website

Good morning premium people :slight_smile:. I would like to ask you a question, because I’m a little stuck on this issue.

I’m working on the integration of a WPMU with another community, and I’m trying to pass/force authentication from the main site (session + cookies) to WPMU without needing users to login again . After digging and googling around I’ve managed this solution:

add_action(‘init’,’do_our_login’:wink:;

function do_our_login(){

session_start();

if($_SESSION!=””:wink::

wp_authenticate($_SESSION, ”:wink:;

wp_set_auth_cookie($_SESSION, true, ”:wink:;

endif;

return true;

}

but I’m quite sure I’m either missing the point of the whole login system, or at least missing something in this implementation.

Do you have some hint or advice on this? It would be precious…

Thank you!