You are here

function hook_oauth2_server_user_claims in OAuth2 Server 7

Same name and namespace in other branches
  1. 8 oauth2_server.api.php \hook_oauth2_server_user_claims()
  2. 2.0.x oauth2_server.api.php \hook_oauth2_server_user_claims()

Provide new user claims.

Parameters

object $account: The user account for which claims should be returned.

array $requested_scopes: The requested scopes.

Return value

array An array of new user claims.

See also

hook_oauth2_server_user_claims_alter()

1 invocation of hook_oauth2_server_user_claims()
Storage::getUserClaims in lib/Drupal/oauth2_server/Storage.php

File

./oauth2_server.api.php, line 95
Hooks provided by the OAuth2 Server module.

Code

function hook_oauth2_server_user_claims($account, $requested_scopes) {
  $claims = array();
  if (in_array('profile', $requested_scopes)) {
    $claims['custom_claim'] = $account->custom_property;
  }
  return $claims;
}