❔ HttpListener for single use request
Haven't found any useful answers online.
I've got a console app where I want to open the user's main browser to an oauth login page. The callback leads back to the program at localhost. So I believe I need to run an httplistener to capture this callback. However this is the only use I would have in the program's lifetime for the httplistener. The rest of the authorization flow can be maintained through an httpclient.
Is it viable or acceptable to spin up and dispose an httplistener like this? Maybe there's a better option for temporary listeners with asp? Or am I overthinking this and there's another solution?
5 Replies
You could always just use deep linking and make the redirect URL use your custom protocol
So instead of opening
http://localhost?foo=bar
it opens mycoolapp://myapp?foo=bar
Oh that's interesting, about about to take a learning adventure learning adventure has told me there's plenty of resources for how to do this on windows, not so much for mac and linux
Anyone got any tips for that?
this is only really viable if the app is going to be installed
I mean, why wouldn't it be acceptable to use HttpListener like that?
Read that there were some issues with it not deallocating some resource even after being disposed, but naturally I can't find the link to that anymore.
Figured it doesn't hurt to ask and be certain
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.