code: function user_auth_request(options) {
    return function(req, res, next) {
      const { client, } = options;
      const service_name = client.service_name;
      req.controllerData = req.controllerData || {};
      // console.log('user_auth_request', { selectedUserAuthToken, client });
      if (!client.user_email) {
        next();
      } else if (selectedUserAuthToken[service_name] &&
        selectedUserAuthToken[service_name].extensionattributes &&
        selectedUserAuthToken[service_name].extensionattributes.passport[`oauth2client_${service_name}`] &&
        selectedUserAuthToken[service_name].extensionattributes.passport[`oauth2client_${service_name}`].accesstoken) {
        req.controllerData.authorization_header = 'Bearer ' + selectedUserAuthToken[service_name].extensionattributes.passport[`oauth2client_${service_name}`].accesstoken;
        next();
      } else {
        const coreDataModel = passportLocals.auth.getAuthCoreDataModel({ entitytype: client.user_entity_type, });
  
        coreDataModel.load({
          query: { email: client.user_email, },
        })
          .then(user => {
            // console.log({ user });
            selectedUserAuthToken[service_name] = user;
            if (user) {
              req.controllerData.authorization_header = 'Bearer ' + selectedUserAuthToken[service_name].extensionattributes.passport[`oauth2client_${service_name}`].accesstoken;
            }
            // console.log('req.controllerData.authorization_header', req.controllerData.authorization_header);
            next();
          })
          .catch(next);
      }
    };
  }
docs: set controller data auth header, for making authenticated API requests later
  @param  {object} options	pass the client configuration from the login extension settings
  @return {Function} returns the express middleware for the oauth callback