How can I programmaticaly submit the user edit form in Drupal 8?
I was mistaken when I said "auth_user_id" is always zero.  It isn't.  It contains the user's ID, as you would expect.  That makes this task fairly simple.  Here is the function for my logout endpoint:

public function logout($name = NULL) {

    if ($name) {
      $user = user_load_by_name($name);
      if ($user) {
        $uid = $user-&gt;id();

        $msg = 'User ' . $name . ' (uid: ' . $uid . ') logged out of app.';
        \Drupal::logger('orb_common')-&gt;notice($msg);

        // Not sure if it would be a better practice to set the status to zero, or delete.  In this example I delete the row.     
        $query = \Drupal::database()-&gt;delete('oauth2_token');
        $query-&gt;condition('auth_user_id', $uid);
        $query-&gt;execute();
      }
    }

    $response['data'] = [];
    $response['method'] = 'POST';

    return new JsonResponse($response);
  }


In my routing file I have...

orb_common.orb_common_logout:
  path: '/orb_common/logout/{name}'
  defaults:
    _controller: '\Drupal\orb_common\Controller\CommonController::logout'
    _title: 'Logout'
  requirements:
    _permission: 'edit activity entities'


The JsonResponse at the end of my logout function presumably isn't important in this case.  The main thing is to pass a UID or username to Drupal in the URL of the endpoint, and then delete/update the relevant row in the oauth2_token table.  At least, that is working in my app.