How to do remote login?


I have to make a remote login system. Example:

site 1 has all the user’s details in database.
site 2 has no db but they have web pages of which some can be viewed without login and some by logging in only.

user goes to site 2 and tries to view restricted content but a login page is displayed. user enters their username / password and that then needs to be check on site 1. if the username / password is okay then user can now view restricted pages on site 2.

so if site 1 says user is legit then site 2 keeps on showing the restricted pages else it should not show.

How to achieve this specifically without doing much on site 2 ?



Anyone ?!