         task.resume()
     }
     
-    private func makeRequestWithAuth(shibbolethUrl: String, html: String, _ completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) {
+    private func makeRequestWithAuth(targetUrl: String, shibbolethUrl: String, html: String, _ completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) {
         guard let passcode = html.getMatches(for: "name=\"passcode\" value=\"(.*?)\"").first,
                 let required = html.getMatches(for: "name=\"required\" value=\"(.*?)\"").first,
                 let appfactor = html.getMatches(for: "name=\"appfactor\" value=\"(.*?)\"").first,

                if urlStr == targetUrl {
                    completionHandler(data, response, error)
                } else if urlStr.contains(self.authUrl) {
                    self.makeRequestWithAuth(shibbolethUrl: shibbolethUrl, html: html as String, completionHandler)
                } else {
                    self.makeRequestWithShibboleth(shibbolethUrl: shibbolethUrl, html: html as String, completionHandler)
                }
            } else {
                completionHandler(nil, nil, NetworkingError.authenticationError)

        task.resume()
    }
    
    private func makeRequestWithShibboleth(targetUrl: String, shibbolethUrl: String, html: String, _ completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) {
        guard let samlResponse = html.getMatches(for: "<input type=\"hidden\" name=\"SAMLResponse\" value=\"(.*?)\"/>").first,
            let relayState = html.getMatches(for: "<input type=\"hidden\" name=\"RelayState\" value=\"(.*?)\"/>").first?.replacingOccurrences(of: "&#x3a;", with: ":") else {
                HTTPCookieStorage.shared.removeCookies(since: Date(timeIntervalSince1970: 0))
