You are here

function hook_openid_connect_save_userinfo in OpenID Connect / OAuth client 8

Save userinfo hook.

This hook runs after the claim mappings have been applied by the OpenID Connect module, but before the account will be saved.

A popular use case for this hook is mapping additional information like user roles or other complex claims provided by the identity provider, that the OpenID Connect module has no mapping mechanisms for.

Parameters

\Drupal\user\UserInterface $account: A user account object.

array $context: An associative array with context information:

  • tokens: Array of original tokens.
  • user_data: Array of user and session data from the ID token.
  • userinfo: Array of user information from the userinfo endpoint.
  • plugin_id: The plugin identifier.
  • sub: The remote user identifier.
  • is_new: Whether the account was created during authorization.

Deprecated

in openid_connect:8.x-1.0-beta6 and is removed from openid_connect:8.x-2.0. Use hook_openid_connect_userinfo_save() instead.

See also

https://www.drupal.org/project/openid_connect/issues/2912214

File

./openid_connect.api.php, line 291
Documentation for OpenID Connect module APIs.

Code

function hook_openid_connect_save_userinfo(UserInterface $account, array $context) {
}