Checking two databases when logging in a user with a custom module I am trying to create a module that will check for two databases when logging in a user to Drupal. If drupal's native login is a success but the external application does not have that account, then the module will create an account on the external application. If the account is not on drupal but is on the external application then drupal will create a local account. If the user does not exist on either database then the login will fail. Which hook(s) would I need to implement this in a module?
Never tried, but you can basicaly:


try hook_user() but you may not catch the case where the user doesn't exists in drupal but your other site.
create your own login form &amp; callback and:

check if user exists in drupal with user_external_load()
if user exists on your external site either login or register on drupal using user_external_login_register()



You may find some interesting code in the openid_authentication().