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?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
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.
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