[support] Writing authentication module - solved

Matt Connolly matt at cabinetuk.com
Wed Jun 25 10:42:46 UTC 2008


found it.

i need to call:

user_external_login

which was being called automatically by user_external_login_register,  
which is why it was working for new users and not existing users.

-matt



On 25/06/2008, at 11:24 AM, Matt Connolly wrote:

> 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
>
>
> -- 
> [ Drupal support list | http://lists.drupal.org/ ]



More information about the support mailing list