You are here

function openid_connect_extract_sub in OpenID Connect / OAuth client 8

Same name and namespace in other branches
  1. 7 openid_connect.module \openid_connect_extract_sub()

Get the 'sub' property from the user data and/or user claims.

The 'sub' (Subject Identifier) is a unique ID for the external provider to identify the user.

Parameters

array $user_data: The user data as returned from OpenIDConnectClientInterface::decodeIdToken().

array $userinfo: The user claims as returned from OpenIDConnectClientInterface::retrieveUserInfo().

Return value

string|false The sub, or FALSE if there was an error.

Deprecated

in openid_connect:8.x-1.0-beta6 and is removed from openid_connect:8.x-2.0. Use Drupal\openid_connect\OpenIDConnect::extractSub() or \Drupal::service('openid_connect.openid_connect')->extractSub() instead.

See also

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

File

./openid_connect.module, line 405
Hook implementations of the OpenID Connect module.

Code

function openid_connect_extract_sub(array $user_data, array $userinfo) {
  @trigger_error("openid_connect_extract_sub() is deprecated in openid_connect:8.x-1.0-beta6 and is removed from openid_connect:8.x-2.0. Use Drupal\\openid_connect\\OpenIDConnect::extractSub() or \\Drupal::service('openid_connect.openid_connect')->extractSub() instead. See https://www.drupal.org/project/openid_connect/issues/2961938", E_USER_DEPRECATED);
  return \Drupal::service('openid_connect.openid_connect')
    ->extractSub($user_data, $userinfo);
}