{"action":"created","issue":{"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-objc/issues/681","repository_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-objc","labels_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-objc/issues/681/labels{/name}","comments_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-objc/issues/681/comments","events_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-objc/issues/681/events","html_url":"https://github.com/AzureAD/azure-activedirectory-library-for-objc/issues/681","id":162787929,"number":681,"title":"2.2.0.1 Calling Cancel before Acquire not working","user":{"login":"nhart12","id":8458409,"avatar_url":"https://avatars.githubusercontent.com/u/8458409?v=3","gravatar_id":"","url":"https://api.github.com/users/nhart12","html_url":"https://github.com/nhart12","followers_url":"https://api.github.com/users/nhart12/followers","following_url":"https://api.github.com/users/nhart12/following{/other_user}","gists_url":"https://api.github.com/users/nhart12/gists{/gist_id}","starred_url":"https://api.github.com/users/nhart12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhart12/subscriptions","organizations_url":"https://api.github.com/users/nhart12/orgs","repos_url":"https://api.github.com/users/nhart12/repos","events_url":"https://api.github.com/users/nhart12/events{/privacy}","received_events_url":"https://api.github.com/users/nhart12/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-28T21:08:37Z","updated_at":"2016-06-29T00:43:38Z","closed_at":null,"body":"My iOS app has different environment settings and different AD's it hits per environment. When a user switches environments while a current webview auth session is active, I need to cancel any previous sessions and create a new AuthContext with different settings. This worked fine in 1.2.7 by calling             ADAuthenticationBroker.sharedInstance().cancel().\r\n\r\nIn 2.2.0 I call ADWebAuthController.cancelCurrentWebAuthSession() before setting up the new Auth context, but it seems that the cancel doesn't actually happen on the previous session until later on, so the new acquireTokenWithResource call always fails with the following message:\r\n\r\nThe user is currently prompted for credentials as result of another acquireToken request. Please retry the acquireToken call later.\r\nIs there a better flow I can use to cancel and/or switch AD's on the fly like this?"},"comment":{"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-objc/issues/comments/229225733","html_url":"https://github.com/AzureAD/azure-activedirectory-library-for-objc/issues/681#issuecomment-229225733","issue_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-objc/issues/681","id":229225733,"user":{"login":"RPangrle","id":7004783,"avatar_url":"https://avatars.githubusercontent.com/u/7004783?v=3","gravatar_id":"","url":"https://api.github.com/users/RPangrle","html_url":"https://github.com/RPangrle","followers_url":"https://api.github.com/users/RPangrle/followers","following_url":"https://api.github.com/users/RPangrle/following{/other_user}","gists_url":"https://api.github.com/users/RPangrle/gists{/gist_id}","starred_url":"https://api.github.com/users/RPangrle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RPangrle/subscriptions","organizations_url":"https://api.github.com/users/RPangrle/orgs","repos_url":"https://api.github.com/users/RPangrle/repos","events_url":"https://api.github.com/users/RPangrle/events{/privacy}","received_events_url":"https://api.github.com/users/RPangrle/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T00:43:38Z","updated_at":"2016-06-29T00:43:38Z","body":"The backing implementation of that cancel didn't change, we just renamed the API to make it more explicit as to what it does. There's never been a sure-fire mechanism for canceling a previous session in ADAL (after all if it wasn't web auth it wouldn't cancel anything at all). Nor has the cancel ever been synchronous. What *did* change was all the extraneous dispatch_asyncs that ADAL used to do but doesn't anymore. If I had to guess what's happening here is that it worked in 1.2.x as a side effect of some of the poorly written threading code in ADAL, and doesn't work now because ADAL only dispatches when it's necessary.\r\n\r\nIf you need to be able to rapid-fire web auths in such a manner I would recommend keeping a semaphore in your completion handler that you can wait on before making another acquire request."}}
{"actor":{"display_login":"RPangrle"}}