Suppressing automatic retry on HTTP 401 RRS feed

  • Question

  • Using OAuth, when I revoke my credentials on the server, it will reply to the next request with an error code 401.

    But when using WinJS.xhr/XmlHttpRequest, the runtime will automatically re-send the request, leaving out the Authorization header. Then, the server replies with a 400 Bad Request, which is then passed on to my error handler. Why?!?!

    There is nothing in RFC 2616 which suggests that this behaviour would make any sense. Debugging such stuff is complicated. Luckily Wireshark runs on Windows 8.. and our test environment doesn't force HTTPS.

    But now, there is no way for me to find out that my authorization has been revoked. A web search suggests that this behaviour is a known and relatively widespread problem. Is there any way to prevent this behaviour to get the real 401 error in my application?

    Friday, January 11, 2013 10:52 AM

All replies

  • Hi,

    Try to use Fiddler debug when using Winjs.xhr.

    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 14, 2013 10:51 AM
  • Thanks for the tip. Fiddler looks like a nice tool, but normally I'm used to Wireshark, which now works on Win8 again just fine.

    Still, it would be great if one could somehow suppress this automatic re-sending of the request and receive the 401 error reply instead.

    Monday, January 14, 2013 1:22 PM