function MODULE_oauth2_user_alter in OAuth2 Login 8
Same name and namespace in other branches
- 7.2 oauth2_user/oauth2_user.api.php \MODULE_oauth2_user_alter()
Implements hook_oauth2_user_alter().
$oauth2_user is the remote user profile that comes from the server.
File
- oauth2_user/
oauth2_user.api.php, line 55 - Functions that can be used by other modules.
Code
function MODULE_oauth2_user_alter(&$oauth2_user) {
// Keep only the fields of the user profile that we are interested in.
$remote_user = [
'projects' => $oauth2_user['projects'],
'permissions' => $oauth2_user['permissions'],
'uid' => $oauth2_user['identifier'],
'name' => $oauth2_user['displayName'],
];
$oauth2_user = $remote_user;
}