I have integrated ADAL library into my iOS application and it\'s working fine. But now I want to log out from ADAL. How can I do log out?
This swift 3 code worked for me (ADAL 2.5.1):
Destroy the keystore:
guard let clientId = getAuthConfig().clientId else {
// freak out
print("Auth.logout: I freaked out getting the client ID ")
return
}
ADKeychainTokenCache.defaultKeychain().removeAll(forClientId: clientId, error: nil)
And clear the cookies:
let cookieJar = HTTPCookieStorage.shared
guard let cookies = cookieJar.cookies else { return }
let cookiesArr = Array(cookies)
for cookie: HTTPCookie in cookiesArr {
print(cookie.name)
if (cookie.name == "SignInStateCookie" || cookie.name == "ESTSAUTHPERSISTENT" || cookie.name == "ESTSAUTHLIGHT" || cookie.name == "ESTSAUTH" || cookie.name == "ESTSSC") {
cookieJar.deleteCookie(cookie)
}
}