Turn Drupal into a USER API
Install and configure services module in site A, and on site B you will have to write a custom php post method,

POST http://example.com/rest/user/login

Content-Type: application/json
{
"username":"user_1",
"password":"password"
}


If the response you get from this post method is status 200 then you can verify that the username and password are matching.

Some useful resources:

Services installation doc: https://drupal.stackexchange.com/a/15718

Also found php-curl example here: https://www.drupal.org/node/1334758