                 let urlStr = response.url?.absoluteString {
                 if urlStr == targetUrl {
                     completionHandler(data, response, error)
+                    UserDefaults.standard.storeCookies()
                 } else if urlStr.contains(self.reauthUrl) {
                     self.makeRequestWithReauth(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()

                }
            } else {
                completionHandler(nil, nil, NetworkingError.authenticationError)
                UserDefaults.standard.storeCookies()
            }
        }
        task.resume()
