OAuth2: Add support for localhost-based authentication
Some Oauth2 configurations require a localhost to finish the authorization process. Add support for it.
The logic here is similar to mutt_oauth2.py. It creates a small server that will bind into localhost on a random port and wait for the auth code. It does that if there is "localhost" at request_uri.
Edited by Matthias Andree