Recently I have upgraded a customer site from Drupal 5 to Drupal 6. The site contains a number of custom modules that required considerable work because of some changes in the Drupal API. One of the API changes is the removal of hook_info and hook_auth.
The new authentication mechanism has two advantages:
First of all, two authentication-specific hooks have been eliminated. There is no replacement hook, instead you must use hook_form_alter to replace the built-in validation functions of the user login form. This is a more general and more flexible approach and it shows the power of the current form API. You can check user_login_block and user_login_default_validators for examples.
Secondly, there is a lot more flexibility to do error reporting when authentication fails. In Drupal 5 when hook_auth returned false, Drupal would always display the error message "Sorry, unrecognized username or password. Have you forgotten your password?" even though the real problem might be something else, for example a remote server responsible for doing the actual verification of the password is not available. In Drupal 6 you can fully control which messages get displayed during an authentication failure.
Even though there is some work involved to migrate custom authentication functionality to Drupal 6, the end result is code that is much cleaner and more powerful.

6 Comments
Im having trouble getting
Submitted by Chicago Web Dev... on
Im having trouble getting the hook_auth to call! Does this happen after a successful login only?
Your notes on the messaging
Submitted by AWM on
Your notes on the messaging changes to hook_auth helped with a Drupal 5 to Drupal 6 migration project. Thanks for the post!
Its great thing that the two
Submitted by Michele Baratta on
Its great thing that the two authentication-specific hooks have been eliminated. Goodbye replacement hook, and thanks to the new must use hook_form_alter to replace the built-in validation functions of the user login form. This is indeed a more general and more flexible approach and it shows the power of the current form API.
I'm with Michelle. Good
Submitted by UHC on
I'm with Michelle. Good riddance to the replacement hook.
I upgraded from drupal 5 to
Submitted by Motorcycle Glasses on
I upgraded from drupal 5 to 6 and had a little difficulty as documentation is a little poor. I finally figured it out and do like the functionalty better!
I think it might be time for
Submitted by Car Eyelashes on
I think it might be time for me to upgrade is there a how to link somewhere posted?