We have two different wordpress domains with different databases, How to code for same user login on bothe the sites. We have to use different databases not one.
You can try and setup the wordpress network solution to achieve this.
alternatively there is a third party method if this does not achieve what you want.
there is a premium plugin by wpmu that can do this as well