send digest authentication with arduino

hello i am in desperate need of a program to login to my ip cameras web interface that uses digest authentication. i just want to send a command using http but im stuck at the login. theres no way to turn the authentication off. i dont have any example code to provide because i cant find any information on this subject as far as sending the request and i think the hashing is just too advanced for me.

can someone tell me why this digest example code from the here is giving me error “exit status 1
cannot declare variable ‘client’ to be of abstract type ‘WiFiClient’” im using esp8266 core 2.4.2

/*
    This sketch shows how to handle HTTP Digest Authorization.
    Written by Parham Alvani and Sajjad Rahnama, 2018-01-07.
   This example is released into public domain,
   or, at your option, CC0 licensed.
*/

#include <ESP8266WiFi.h>
#include <Wire.h>
#include <ESP8266HTTPClient.h>

const char* ssid = "SSID";
const char* ssidPassword = "PASSWORD";

const char *username = "admin";
const char *password = "admin";

const char *server = "http://httpbin.org";
const char *uri = "/digest-auth/auth/admin/admin/MD5";

String exractParam(String& authReq, const String& param, const char delimit) {
  int _begin = authReq.indexOf(param);
  if (_begin == -1) {
    return "";
  }
  return authReq.substring(_begin + param.length(), authReq.indexOf(delimit, _begin + param.length()));
}

String getCNonce(const int len) {
  static const char alphanum[] =
    "0123456789"
    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    "abcdefghijklmnopqrstuvwxyz";
  String s = "";

  for (int i = 0; i < len; ++i) {
    s += alphanum[rand() % (sizeof(alphanum) - 1)];
  }

  return s;
}

String getDigestAuth(String& authReq, const String& username, const String& password, const String& uri, unsigned int counter) {
  // extracting required parameters for RFC 2069 simpler Digest
  String realm = exractParam(authReq, "realm=\"", '"');
  String nonce = exractParam(authReq, "nonce=\"", '"');
  String cNonce = getCNonce(8);

  char nc[9];
  snprintf(nc, sizeof(nc), "%08x", counter);

  // parameters for the RFC 2617 newer Digest
  MD5Builder md5;
  md5.begin();
  md5.add(username + ":" + realm + ":" + password);  // md5 of the user:realm:user
  md5.calculate();
  String h1 = md5.toString();

  md5.begin();
  md5.add(String("GET:") + uri);
  md5.calculate();
  String h2 = md5.toString();

  md5.begin();
  md5.add(h1 + ":" + nonce + ":" + String(nc) + ":" + cNonce + ":" + "auth" + ":" + h2);
  md5.calculate();
  String response = md5.toString();

  String authorization = "Digest username=\"" + username + "\", realm=\"" + realm + "\", nonce=\"" + nonce +
                         "\", uri=\"" + uri + "\", algorithm=\"MD5\", qop=auth, nc=" + String(nc) + ", cnonce=\"" + cNonce + "\", response=\"" + response + "\"";
  Serial.println(authorization);

  return authorization;
}

void setup() {
  Serial.begin(115200);

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, ssidPassword);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  HTTPClient http;

  WiFiClient client;

  Serial.print("[HTTP] begin...\n");

  // configure traged server and url
  http.begin(client, String(server) + String(uri));


  const char *keys[] = {"WWW-Authenticate"};
  http.collectHeaders(keys, 1);

  Serial.print("[HTTP] GET...\n");
  // start connection and send HTTP header
  int httpCode = http.GET();

  if (httpCode > 0) {
    String authReq = http.header("WWW-Authenticate");
    Serial.println(authReq);

    String authorization = getDigestAuth(authReq, String(username), String(password), String(uri), 1);

    http.end();
    http.begin(client, String(server) + String(uri));

    http.addHeader("Authorization", authorization);

    int httpCode = http.GET();
    if (httpCode > 0) {
      String payload = http.getString();
      Serial.println(payload);
    } else {
      Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
    }
  } else {
    Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
  }

  http.end();
  delay(10000);
}

I get

../ATest.ino:118:52: error: no matching function for call to 'HTTPClient::begin(WiFiClient&, StringSumHelper&)'
http.begin(client, String(server) + String(uri));

ESP8266HTTPClient doesn't take client as parameter. remove the client parameter

I think you have to use ESP8266Wifi library from the git page because i can get the error you got if i use the ESP8266Wifi library in the appdata folder. which i don't know why i think it had something to do with WifiSecure. but if i drop the Esp8266Wifi library into my library folder in documents i get the abstract error.

if i remove client it then throws error

exit status 1
cannot declare variable 'client' to be of abstract type 'WiFiClient'

you write you use 2.4.2 and the library is part of the core. take the whole core if you want to use the newest ESP8266WiFi library

let me know if i forgot something but i used board manager to install the esp8266. then i went here "GitHub - esp8266/Arduino: ESP8266 core for Arduino" copied everything from the library folder to my library folder ?

notsolowki:
let me know if i forgot something but i used board manager to install the esp8266. then i went here "GitHub - esp8266/Arduino: ESP8266 core for Arduino" copied everything from the library folder to my library folder ?

only the ESP8266WiFi library?

Juraj:
only the ESP8266WiFi library?

no all of then. and i can confirm in the verbose that it is indeed using the files i placed in the documents folder

notsolowki:
no all of then. and i can confirm in the verbose that it is indeed using the files i placed in the documents folder

it is possible that the current GitHub repo version is inconsistent