public static function get_system_oauth_client(issuer $issuer) {
        $systemaccount = self::get_system_account($issuer);
        if (empty($systemaccount)) {
            return false;
        }
        // Get all the scopes!
        $scopes = self::get_system_scopes_for_issuer($issuer);

        $client = new \core\oauth2\client($issuer, null, $scopes, true);

        if (!$client->is_logged_in()) {
            if (!$client->upgrade_refresh_token($systemaccount)) {
                return false;
            }
        }
        return $client;
    }
public static function get_system_oauth_client(issuer $issuer) {
        $systemaccount = self::get_system_account($issuer);
        if (empty($systemaccount)) {
            return false;
        }
        // Get all the scopes!
        $scopes = self::get_system_scopes_for_issuer($issuer);

        $client = new \core\oauth2\client($issuer, null, $scopes, true);

        if (!$client->is_logged_in()) {
            if (!$client->upgrade_refresh_token($systemaccount)) {
                return false;
            }
        }
        return $client;
    }
public static function get_system_oauth_client ( issuer $ issuer ) { $ systemaccount = self :: get_system_account ( $ issuer ) ; if ( empty ( $ systemaccount ) ) { return false ; } // Get all the scopes! $ scopes = self :: get_system_scopes_for_issuer ( $ issuer ) ; $ client = new \ core \ oauth2 \ client ( $ issuer , null , $ scopes , true ) ; if ( ! $ client -> is_logged_in ( ) ) { if ( ! $ client -> upgrade_refresh_token ( $ systemaccount ) ) { return false ; } } return $ client ; }
Get an authenticated oauth2 client using the system account.
This call uses the refresh token to get an access token.

@param \core\oauth2\issuer $issuer
@return \core\oauth2\client|false An authenticated client (or false if the token could not be upgraded)
@throws moodle_exception Request for token upgrade failed for technical reasons
Get an authenticated oauth2 client using the system account . This call uses the refresh token to get an access token .