Is it possible to login to Drupal with a custom user field, instead of username/pass?
This is the code you need. In the Drupal site create the following module:

Update:

function my_special_login_menu()
{
    $items['authinticate-by-customerid'] = array( // or any other custom path you choose
        'title' =&gt; 'Login by customerid',
        'access callback' =&gt; true, // no point in authenticating at this point in code execution
        'page callback' =&gt; 'my_special_login_function',
        'type' =&gt; MENU_CALLBACK,
        );
    return $items;
}

function my_special_login_function($customerid)
{
    // post the data to /authinticate-by-customerid as json with a parameter / property named customerid holding the customerid
    $postData = file_get_contents('php://input');

    $Data = json_decode($postData);

    $query = new EntityFieldQuery();
    $query-&gt;entityCondition('entity_type', 'user')
        -&gt;propertyCondition('uid', 1, '&lt;&gt;')
        // User number 1 should not be able to log in using this method
        -&gt;fieldCondition('field_customerid', 'value', $Data-&gt;customerid, '=')
        -&gt;range(0,1);

    $result = $query-&gt;execute();

    if (isset($result['user'])) {
        $uid = array_keys($result['user'])[0];
        $account = user_load($uid);
        global $user;
        $user-&gt;uid = $uid;
        $user-&gt;name = $account-&gt;name;
        $user-&gt;timezone = $account-&gt;timezone;
        user_login_finalize(); // Log user in
        drupal_goto('/user'); // or any other path to redirect logged in users to
    } else {
        drupal_goto('/user/register');
    }

}


For this code to work you need Entity API module and you should serve the site over SSL in order to encrypt the data transferred between the two sites.