add_filter('jwt_auth_valid_credential_response', function ($response, $user) {
    // Aggiungi dati extra alla risposta JWT (opzionale)
    $response['first_name'] = get_user_meta($user->ID, 'first_name', true);
    $response['last_name'] = get_user_meta($user->ID, 'last_name', true);
    $response['roles'] = $user->roles;
    return $response;
}, 10, 2);