none
OAuth 2.0 issue with process hanging if auth doesn't complete RRS feed

  • Question

  • I have an application. It's job is to handle the OAuth journey between a client app and the authenticating server. One of the first things I need to do is get the auth code from the server. The basic code is:

    var http = new HttpListener();
    http.Prefixes.Add(appSettings.RedirectUrl);
    http.Start();
    System.Diagnostics.Process.Start(url);
    var context = http.GetContext();

    So once the process starts it opens the web page and it will sit there and wait until the user has logged into the website, granted authority, and it redirects. From which point the last line above picks up the context and off it goes and continues. However, if the user doesn't not complete the OAuth journey, say they close the browser window, the application sits and waits forever more waiting.

    What can I do to stop this process from hanging? If the user doesn't complete the OAuth journey, I need to be able to get out of this wait.

    Wednesday, June 26, 2019 11:31 AM

All replies

  • Hi MrSnert,

    Thank you for posting here.

    Since this thread is related to OAuth Authorization, I suggest that you could post in the following forum.

    https://forums.asp.net/

    The Visual C# forum discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, June 27, 2019 2:37 AM
  • You know, it doesn't matter which forum I post in, it is ALWAYS the wrong one. As soon as I say this is a web service I get told to post in the web services forum. As it is a Windows app and not a web app I felt that the ASP.NET forum wasn't the right place. I knew someone would disagree. Over the last year I've posted probably 20 questions in different forums, whether here or forums.asp.net and almost without exception, one of the first comments will be something like "this isn't in the right forum, maybe you should post in xxxx".

    As what I am doing is covered by about 5 different forums within either of the 2 sites, no matter what I do, it is going to be in the wrong forum. I get quite hopeful when I get an email in the morning saying there is a reply which might help me solve the issue, and then I get another one of these telling me I posted in the wrong forum. Apologies if this sounds like I'm not happy, but I'm not. I just want help with the problem rather than help finding a different forum because someone disagrees with my decision to place the question here. I guarantee you, if I post it over there, I will get the same response.


    • Edited by MrSnert Friday, June 28, 2019 8:28 AM
    Friday, June 28, 2019 8:26 AM
  • Just as an example, searching for OAuth on forums.asp.net, there are questions posted in the following forums:

    • Getting Started
    • Security
    • ASP.NET Core
    • WCF, ASMX and other Web Services
    • Web API
    • MVC
    • ASP.NET Web Pages

    This just shows that a decision to post in one forum for whatever reason, is always going to differ from someone else's opinion on the matter.

    Friday, June 28, 2019 10:56 AM