- π¨πSwitzerland dpacassi ZΓΌrich, Switzerland
We ran in the same issue, following code should work with the current state on dev:
/** * Implements hook_oauth2_server_user_claims_alter(). * * @param array $claims * An array of claims. * @param \Drupal\user\UserInterface $account * A user account object. * @param array $requested_scopes * An array of requested scopes. */ function your_module_oauth2_server_user_claims_alter(array &$claims, \Drupal\user\UserInterface $account, array $requested_scopes) { if (in_array('openid', $requested_scopes)) { $claims['zipcode'] = $account->get('field_zip')->value; $claims['town'] = $account->get('field_city')->value; $claims['country'] = $account->get('field_country')->value; // etc. } }
- Status changed to Closed: outdated
4 months ago 9:49pm 7 March 2024