Answered by:
Could not cancel the WebAuthenticationBroker.authenticateAsync() dialog after RP(Build 8400)

Question
-
Before Consumer Preview (Build 8250), we could cancel the dialog of WebAuthenticationBroker.authenticateAsync() just like cancel a Promise. For example,
authenticatePromise = Windows.Security.Authentication.Web.WebAuthenticationBroker.authenticateAsync( Windows.Security.Authentication.Web.WebAuthenticationOptions.none, new Windows.Foundation.Uri(oauthUrl), new Windows.Foundation.Uri(callbackUrl));
authenticatePromise.then(onCompleteCallback, onErrorCallback);
and call
authenticatePromise.cancel();
when we need to do this.
The dialog will be closed immediately and return error message 'Canceled'.
After Build 8400, call authenticatePromise.cancel(); will do nothing immediately.
But after user finished authentication or press back button, UI still receive error callback with 'Canceled' message instead of complete callback or "WebAuthenticationStatus.userCancel".
Is this new limitation?
And how to cancel the dialog of WebAuthenticationBroker.authenticateAsync() by code?
Monday, June 11, 2012 3:03 AM
Answers
-
Hi Sars,
I filed a bug for this. This is incorrect behavior. I do not have an ETA for a fix however.
-Jeff
Jeff Sanders (MSFT)
- Marked as answer by Dino He Tuesday, June 26, 2012 9:07 AM
Thursday, June 21, 2012 5:36 PMModerator
All replies
-
Hi Sars,
Can you post a real simple sample of this for me to investigate? Can you simply modify the sample prehaps?
-Jeff
Jeff Sanders (MSFT)
Wednesday, June 13, 2012 1:11 PMModerator -
Hi Jeff,
I modified the sample "Snap View" to reproduce.
The sample for Build 8250: https://dl.dropbox.com/u/222042/SnapSampleWithWebAuth_8250.zip
And for Build 8400: https://dl.dropbox.com/u/222042/SnapSampleWithWebAuth_8400.zip
There is only two differences between these two sample: "//Microsoft.WinJS.0.6/" -> "//Microsoft.WinJS.1.0.RC/" and References in project setting.
Usage:
1. Open project and launch app
2. Click "Launch Web Auth" button
3. Drag app to snap view (or press "WinKey + . " on keyboard)
4(8250). In Build 8250, the dialog of WebAuthenticationBroker.authenticateAsync() will be closed
4(8400). In Build 8400, nothing happened
5(8400). Click "Back" button. Pop a message with "Canceled" message by error callback instead of complete callback
- Edited by Sars C Thursday, June 14, 2012 8:28 AM
Thursday, June 14, 2012 8:25 AM -
Thanks Sars!
-Jeff
Jeff Sanders (MSFT)
Thursday, June 14, 2012 11:49 AMModerator -
Hi Sars,
I filed a bug for this. This is incorrect behavior. I do not have an ETA for a fix however.
-Jeff
Jeff Sanders (MSFT)
- Marked as answer by Dino He Tuesday, June 26, 2012 9:07 AM
Thursday, June 21, 2012 5:36 PMModerator -
Thanks for your help!
Friday, June 22, 2012 2:14 AM -
Have this been fixed? I'm trying to use authenticateAsync() for facebook authentication following this sample at http://code.msdn.microsoft.com/windowsapps/Web-Authentication-d0485122
but I'm not sure if this bug is related. When the facebook login pop-up shows up, I can't close it by hitting on the Cancel button. It doesn't nothing.
I also posted a reply here: http://social.msdn.microsoft.com/Forums/en-US/b82943db-e576-4e41-89b2-c66190692219/windows-store-id-in-facebook-app?forum=windowsstore
Tuesday, March 4, 2014 6:53 AM