Getting session variable in view contextual filter drupal 8
You'll need to create a custom module and pass the value Group ID value using hook_views_pre_view

Example:

/*
 * Implements hook_views_pre_view()
 */
function mymodule_views_pre_view(ViewExecutable $view, $display_id, array &amp;$args) {
  // Modify contextual filters for my_special_view.
  if ($view-&gt;id() == 'my_special_view') { // target a specific view
    // if you want you could make it even more specific by adding ex: "&amp;&amp; $display_id == 'block_1')"
    $group_id = $_SESSION['groupbysession']['group_id'];
    $args[0] = $group_id; // set argument
  }
}