I am using the ADAL iOS library for Azure authentication. However, I had a problem if I first signed up with one account, and then log out and log in to another account. I get the following error even if I set AD_PROMPT_ALWAYS.
2015-08-31 12:50:39.939 PortalDev[908:174411] ADALiOS [2015-08-31 11:50:39 - xxx-xxx-xxx-xxx-xxx] ERROR: Error raised: 19. Additional Information: Domain: ADAuthenticationErrorDomain ProtocolCode:(null) Details:Different user was authenticated. Expected: ' aaa@xxx.com '; Actual: ' bbb@xxx.com '. Either the user entered credentials for different user, or cookie for different logged user is present. Consider calling acquireToken with AD_PROMPT_ALWAYS to ignore the cookie.. ErrorCode: 19. 2015-08-31 12:50:39.943 PortalDev[908:174411] ADAL Error: 19, Different user was authenticated. Expected: ' aaa@xxx.com '; Actual: ' bbb@xxx.com '. Either the user entered credentials for different user, or cookie for different logged user is present. Consider calling acquireToken with AD_PROMPT_ALWAYS to ignore the cookie. (status: 2)
I cleared the cache and tried and cleared the cookies that I think are:
if (allItems.count > 0) { [cache removeAllWithError:&error]; if (error) { CLSNSLog(@"Error clearing cache: %@", error.errorDetails); } else { CLSNSLog(@"Items removed."); } } else { CLSNSLog(@"Was no user cached."); } NSHTTPCookieStorage* cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; NSArray* cookies = cookieStorage.cookies; if (cookies.count) { for(NSHTTPCookie* cookie in cookies) { CLSNSLog(@"Deleting Auth Cookie %@.", cookie.name); [cookieStorage deleteCookie:cookie]; } CLSNSLog(@"Auth Cookies cleared."); }
But I do not think the cookies have been cleared. The username is pre-populated when I get the login web page. I thought this worked fine a few weeks / months ago, but now there is a problem. Today I am building a library from the latest GitHub source.
Any suggestions on how I can make the username change possible?
source share