in lib.php [69:78]
protected function get_unified_token($system = false, $userid = null) {
global $USER;
$resource = \local_o365\rest\unified::get_tokenresource();
if ($system === true) {
return utils::get_app_or_system_token($resource, $this->clientdata, $this->httpclient);
} else {
$userid = (!empty($userid)) ? $userid : $USER->id;
return \local_o365\oauth2\token::instance($userid, $resource, $this->clientdata, $this->httpclient);
}
}