Added support for authenticating clients using the new OAuth 2.0 login API. Contributed by @ginger.