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?
An update to Rich's excellent answer. First, the interface has changed with the latest ADAL release and you need to access the token cache this way:
#import
[...]
[[ADKeychainTokenCache defaultKeychainCache] removeAllForClientId:ADFS_CLIENT_ID error:&error];
And to clear the cookies, I recommend just deleting the ones that matter instead of clearing them all:
NSHTTPCookieStorage *cookieJar = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie *cookie in [cookieJar cookies]) {
if ([cookie.name isEqualToString:@"MSISAuth"] ||
[cookie.name isEqualToString:@"MSISAuthenticated"] ||
[cookie.name isEqualToString:@"MSISLoopDetectionCookie"]) {
[cookieJar deleteCookie:cookie];
}
}
(I found that AD_PROMPT_ALWAYS didn't work on older ADFS installations and was forced to delete cookies.)