diff --git a/Release/include/cpprest/oauth2.h b/Release/include/cpprest/oauth2.h
index 4650db1f85..f4c2ad79af 100644
--- a/Release/include/cpprest/oauth2.h
+++ b/Release/include/cpprest/oauth2.h
@@ -446,6 +446,24 @@ class oauth2_config
/// Default: "access_token".
///
void set_access_token_key(utility::string_t access_token_key) { m_access_token_key = std::move(access_token_key); }
+
+ ///
+ /// Get the web proxy object
+ ///
+ /// A reference to the web proxy object.
+ const web_proxy& proxy() const
+ {
+ return m_proxy;
+ }
+
+ ///
+ /// Set the web proxy object that will be used by token_from_code and token_from_refresh
+ ///
+ /// A reference to the web proxy object.
+ void set_proxy(const web_proxy& proxy)
+ {
+ m_proxy = proxy;
+ }
private:
friend class web::http::client::http_client_config;
@@ -483,6 +501,8 @@ class oauth2_config
utility::string_t m_scope;
utility::string_t m_state;
+ web::web_proxy m_proxy;
+
bool m_implicit_grant;
bool m_bearer_auth;
bool m_http_basic_auth;
diff --git a/Release/src/http/oauth/oauth2.cpp b/Release/src/http/oauth/oauth2.cpp
index 2f4457689d..caf59c2f34 100644
--- a/Release/src/http/oauth/oauth2.cpp
+++ b/Release/src/http/oauth/oauth2.cpp
@@ -26,6 +26,7 @@
#include "stdafx.h"
using web::http::client::http_client;
+using web::http::client::http_client_config;
using web::http::oauth2::details::oauth2_strings;
using web::http::details::mime_types;
using utility::conversions::to_utf8string;
@@ -134,7 +135,11 @@ pplx::task oauth2_config::_request_token(uri_builder& request_body_ub)
}
request.set_body(request_body_ub.query(), mime_types::application_x_www_form_urlencoded);
- http_client token_client(token_endpoint());
+ // configure proxy
+ http_client_config config;
+ config.set_proxy(m_proxy);
+
+ http_client token_client(token_endpoint(), config);
return token_client.request(request)
.then([](http_response resp)