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

        
        let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
            if let data = data, let html = NSString(data: data, encoding: String.Encoding.utf8.rawValue) {
                self.makeRequestWithShibboleth(shibbolethUrl: shibbolethUrl, html: html as String, completionHandler)
            } else {
                completionHandler(nil, nil, NetworkingError.authenticationError)
            }

        let encodedParams = parameterArray.joined(separator: "&")
        request.httpBody = encodedParams.data(using: String.Encoding.utf8)
        
        let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
            if let response = response as? HTTPURLResponse, let urlStr = response.url?.absoluteString, urlStr == targetUrl {
                completionHandler(data, response, error)
            } else {
                completionHandler(nil, nil, NetworkingError.authenticationError)
            }
            UserDefaults.standard.storeCookies()
        }
        task.resume()
    }
}
