Authentication redirect options

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.

1 Like

You can use localhost as a redirect with a custom port by doing http://localhost:3000/insert/route/here (3000 being the rails development server port)

But you’re required to hard code that port into the application, which was the point. You can’t find an available port dynamically.

1 Like

Ah, my bad. Misinterpreted what dorcomando was asking for.

I’d appreciate an official response in response to my request above.
I think that implementing an authentication method similar to Google’s library would be much more reliable than the other options.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.