【问题标题】:How to clear cache in iOS ADAL library如何清除 iOS ADAL 库中的缓存
【发布时间】:2016-12-25 01:26:33
【问题描述】:

我已在我的 iOS 应用程序中集成 ADAL 库以使用 WAAD 帐户进行身份验证。收到 accessToken 后,登录屏幕(ADAL)会自动消失。现在,如果我尝试调用相同的登录代码以使用不同的用户登录,那么它不会显示任何新的登录屏幕,它会自动使用以前的用户登录并给我新的 accessToken。如何清除以前登录用户的缓存。我使用下面的代码清除缓存但没有使用它。

  [authContext.tokenCacheStore removeAll]; // This method is no more available. Getting error for removeAll method. 
  [authContext.tokenCacheStore removeAllWithError:&error]; // It does not clear cache.

有没有办法清除缓存或显示登录屏幕?请帮我。提前致谢。

【问题讨论】:

  • 实际上同样的问题。你得到答案了吗?
  • 是的,我使用方法 [authContext acquireTokenWithResource:resourceId clientId:clientId redirectUri:redirectUri promptBehavior:AD_PROMPT_REFRESH_SESSION userId:nil extraQueryParameters:nil completionBlock:^(ADAuthenticationResult *result) { }] 将 promptBehavior 设置为 AD_PROMPT_REFRESH_SESSION;
  • 谢谢@GaneshGuturi

标签: ios iphone caching adal


【解决方案1】:

缓存移除意味着从钥匙串中删除令牌。它对 webview 中的 cookie 没有影响。您应该使用 peomptbehavior.always 标志来确保在登录时提示用户输入密码。

【讨论】:

  • 谢谢卡尼什克。我将 promptBehavior 设置为 AD_PROMPT_REFRESH_SESSION,它确实对我有用。
猜你喜欢
  • 2019-09-29
  • 2015-05-26
  • 2020-02-08
  • 2015-04-13
  • 2016-02-20
  • 1970-01-01
  • 2013-09-09
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多