I have figured out how to actually synchronize user login for all sub domains of joomla!. What Joomla does is it stores the session id of a user on a cookie that is: enter image description here
But the name of the cookie is a unique string and the value it has comes from the #__sessions table of your joomla, it is the session id of the user or guest, the name of the cookie changes for every Joomla installation. This means this name will be something else on your site. To get the name of the cookie you need to call the function getName() on the session object as
Now you have the name of the cookie, you need to set the session id of the user that was logged in on the other domain you can get it using ip and apply different filters for it and store it along with the user id. If you get same value set the session id for that user to the cookie. Now setting the value has already logged in the user, but the changes won't reflect until you refresh, so try using
$app = JFactory::getApplication();
just after you set the value, also remember to delete ip and all info just as the user logs out or other user wont be able to log in.
This is how I get passed this issue, so thought it might help someone in future ,if you figure out a better way please share.