The WHMCS AUTH module offers login integration between WHMCS and Drupal. Alters the Drupal login process to authenticate WHMCS users using external API and provides a login block to include in your WHMCS theme. (loginbox.php)
After login if the user hasn't login before it will create a new Drupal user, with "WHMCS user" role assigned, plus an extra WHMCS userid field
{php}
$path = substr($_SERVER[REQUEST_URI], 1);
header("Location: https://www.example.com/user?destination=$path");
exit();
{/php}
{fetch file='http://www.mydomain.com/sites/all/modules/whmcs_auth/loginbox.php'}
Required module WHMCS API