WebAuthenticationBroker.AuthenticateAsync throws exception

6

My code uses :

WebAuthenticationResult WebAuthenticationResult = await
WebAuthenticationBroker.AuthenticateAsync( 
                                        WebAuthenticationOptions.None, 
                                        StartUri, 
                                        EndUri); 

just like the Microsoft Web authentication broker sample

It used to work on my desktop and on my tablet (Surface) but now it is not working on my desktop. It throws exception

The process terminated unexpectedly. (Exception from HRESULT: 0x8007042B)

It is working on the tablet and on different windows-8 desktop.

Any suggestion what can cause this exception?

c#
windows-8
microsoft-metro
windows-store-apps
asked on Stack Overflow Nov 20, 2012 by Ronit • edited Dec 12, 2012 by Eonasdan

2 Answers

0

I'm not sure but I think that the WebAuthBroker needs to be invoke on the UI Thread since it is trying to change something to your UI in the way of showing you the pop-up.

answered on Stack Overflow Jan 8, 2013 by Tom Kerkhove
0

WebAuthenticationBroker.AuthenticateAsync kicks off AuthHost.exe process as a child of the app process, and the HRESULT returned by the exception indicates that AuthHost.exe failed unexpectedly. When launched, AuthHost tries to purge cookies, content and history from non sso containers, and if it fails, it backs off. On the other side, a Windows App runs in a sandbox with a set of permissions different from a desktop application. Thus Internet Explorer itself or a desktop application doing SSO might be able to work normally, but AuthHost will not be allowed to do required clean up on start. In my case, a user running the app was a part of the group that was granted full access to the folder, but the user itself did not have direct file access permissions. However, the group rights got stripped off in the app sandbox. In a default set up, permissions are configured properly, and no such problems should arise. However, in come cases a user moves the Temporary Internet Files to a new location, which might have a slightly different set of file access permissions. The other response on this thread suggests that deleting and re-creating profile helps. This operation resets Temporary Internet Files settings in the Internet Explorer to default, indirectly supporting my suggestion.

answered on Stack Overflow Feb 26, 2015 by Victor U • edited Feb 27, 2015 by Victor U

User contributions licensed under CC BY-SA 3.0