ADAL适用于iOS的异常使用不同的用户登录 [英] ADAL for iOS exception with a different user sign-on

查看:296
本文介绍了ADAL适用于iOS的异常使用不同的用户登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是iOS的ADAL库Azure的身份验证。不过,我有一个问题,如果我第一次与一个帐户登录,然后注销并登录使用其他帐户。我得到以下错误,即使我设置AD_PROMPT_ALWAYS。

I am using the ADAL iOS library for Azure authentication. However, I am having a problem if I first signed on with one account, and then sign-out and sign-in with another account. I get the following error, even though 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 I think:

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.");
        }

不过,我不认为有任何cookies来清除。
用户名是pre填充,当我得到的登录网页。我觉得罚款数周/数月之前,它的工作,但现在似乎有一个问题。我今天新鲜生成库从最新的GitHub源。

But I don't think there were any cookies to clear. The username is pre-filled when I get the logon webpage. I thought it worked fine a few weeks/months ago, but now there seems a problem. I build the library fresh today from the latest GitHub source.

任何建议,我怎么能做出切换用户名可能吗?

Any suggestions how I can make switching user name possible?

推荐答案

该错误消息说:

预计:aaa@xxx.com';实际:bbb@xxx.com

Expected: 'aaa@xxx.com'; Actual: 'bbb@xxx.com'

这表明一个userid参数被传递给acquireToken。这将导致在登录页面输入用户名字段设置为prefilled。但是,错误是说,当用户签署了他们改变了用户名字段给不同的用户。因为你问一个特定的用户,但没有得到该用户的令牌,acquireToken返回一个错误。看到这个答案的更多详细信息:

That indicates that a userId parameter is being passed to acquireToken. That would cause the username field in the sign-in page to be prefilled. However, the error is saying that when the user signed in they changed the username field to a different user. Because you asked for a specific user but did not get a token for that user, acquireToken returns an error. See this answer for more detail:

<一个href=\"http://stackoverflow.com/questions/26694432/adal-ios-different-user-was-authenticated-expected-useramydomain-com-actual/26727024#26727024\">ADAL iOS的 - 不同的用户进行身份验证。预计userA@mydomain.com,实际userB@mydomain.com

这篇关于ADAL适用于iOS的异常使用不同的用户登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆