6

I'm trying to create multiple websites with Drupal Multi-site feature, and I need to understand how the authmap table is used.

What's the purpose of the authmap table?

11

The "authmap" table is used when a user is authenticated using an external site, for example an OpenID server.
For example, in my test site I have used OpenID to create an account. In that table, I then found the user ID of the user account created by Drupal, and the OpenID URL used to authenticate the user (the one provided by the OpenID server).

The comment in user_external_login_register() gives a short explanation of how that table is used, and which functions the modules integrating with an external authentication server should use.

Helper function for authentication modules. Either logs in or registers the current user, based on username. Either way, the global $user object is populated and login tasks are performed.

Keep in mind that in Drupal 8 the "authmap" table, and the functionality provided by the functions using it have been removed. Any module providing the integration with an external authentication server will need to use its own database table, which is what the OpenID module did in Drupal 8, before being dropped off.

1

The authmap serves as a helper to external authentication.

For example, if you use user_external_login_register() in a module of yours that performs this authentication , this module will be associated with the external user in authmap table

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.