I’ve recently started toying around with the v5 of the API and also Google’s YouTube API, both of which use OAuth.
However, Google’s implementation does not restrict you to use a single redirect URL, and their authentication implementation ends up being much easier to work with, their provided library looks for an available TCP port on the hosting machine and then hosts a “web server” on the loopback address with said port, that address is provided as the redirect URL in the auth request, the request URL is launched as a process (which opens it in the default browser on the machine) and the code waits for a response by listening to the first request on the “web server”.
On C# this is a way around using the WebBrowser control which is an awful embedded version of Internet Explorer which by default runs in IE 7 compatibility mode (which causes a lot of issues with modern websites) and requires a change in the registry per-process to change, an alternative is to use CefSharp but that library is overkill for many projects.
I would love to see an option to allow for a dynamic redirect URL or at the very least allow for loopback address (localhost) calls on any port, so that a similar implementation to Google’s could be made for Twitch.