[support] Writing authentication module

Matt Connolly matt at cabinetuk.com
Wed Jun 25 10:24:35 UTC 2008


I'm writing a module in drupal to support remote authentication.  
Basically, our drupal site will have its login/logout controlled by a  
parent site for the company.

This is working for new users. ie: users of the main site who have not  
yet been to the drupal site. Their user account is automatically  
created with data retrieved from the main site.

However, when the user logs in again (second time - so they now have a  
"uid" in the "users" table) when they come back from the remote login  
page, the user hook is called with op = "load" , uid = 0, and the  
account is set up for an anonymous user. This I don't understand.


The code goes basically like this:

--

if ( ! mymodule_user_exists( $username ) ) {

	user_external_login_register( $username, "mymodulename" )

}

$account = user_external_load( $username );

--

Any hints appreciated.
-Matt




More information about the support mailing list