@@ -204,13 +204,15 @@ class oauth2_config
204
204
205
205
oauth2_config (utility::string_t client_key, utility::string_t client_secret,
206
206
utility::string_t auth_endpoint, utility::string_t token_endpoint,
207
- utility::string_t redirect_uri, utility::string_t scope=utility::string_t ()) :
207
+ utility::string_t redirect_uri, utility::string_t scope=utility::string_t (),
208
+ utility::string_t user_agent=utility::string_t ()) :
208
209
m_client_key (std::move(client_key)),
209
210
m_client_secret(std::move(client_secret)),
210
211
m_auth_endpoint(std::move(auth_endpoint)),
211
212
m_token_endpoint(std::move(token_endpoint)),
212
213
m_redirect_uri(std::move(redirect_uri)),
213
214
m_scope(std::move(scope)),
215
+ m_user_agent(std::move(user_agent)),
214
216
m_implicit_grant(false ),
215
217
m_bearer_auth(true ),
216
218
m_http_basic_auth(true ),
@@ -436,23 +438,34 @@ class oauth2_config
436
438
// / </summary>
437
439
void set_access_token_key (utility::string_t access_token_key) { m_access_token_key = std::move (access_token_key); }
438
440
439
- // / <summary>
440
- // / Get the web proxy object
441
- // / </summary>
442
- // / <returns>A reference to the web proxy object.</returns>
443
- const web_proxy& proxy () const
444
- {
445
- return m_proxy;
446
- }
447
-
448
- // / <summary>
449
- // / Set the web proxy object that will be used by token_from_code and token_from_refresh
450
- // / </summary>
451
- // / <param name="proxy">A reference to the web proxy object.</param>
452
- void set_proxy (const web_proxy& proxy)
453
- {
454
- m_proxy = proxy;
455
- }
441
+ // / <summary>
442
+ // / Get the web proxy object
443
+ // / </summary>
444
+ // / <returns>A reference to the web proxy object.</returns>
445
+ const web_proxy& proxy () const
446
+ {
447
+ return m_proxy;
448
+ }
449
+
450
+ // / <summary>
451
+ // / Set the web proxy object that will be used by token_from_code and token_from_refresh
452
+ // / </summary>
453
+ // / <param name="proxy">A reference to the web proxy object.</param>
454
+ void set_proxy (const web_proxy& proxy)
455
+ {
456
+ m_proxy = proxy;
457
+ }
458
+
459
+ // / <summary>
460
+ // / Get user agent to be used in oauth2 flows.
461
+ // / </summary>
462
+ // / <returns>User agent string.</returns>
463
+ const utility::string_t & user_agent () const { return m_user_agent; }
464
+ // / <summary>
465
+ // / Set user agent to be used in oauth2 flows.
466
+ // / If none is provided a default user agent is provided.
467
+ // / </summary>
468
+ void set_user_agent (utility::string_t user_agent) { m_user_agent = std::move (user_agent); }
456
469
457
470
private:
458
471
friend class web ::http::client::http_client_config;
@@ -489,8 +502,9 @@ class oauth2_config
489
502
utility::string_t m_redirect_uri;
490
503
utility::string_t m_scope;
491
504
utility::string_t m_state;
505
+ utility::string_t m_user_agent;
492
506
493
- web::web_proxy m_proxy;
507
+ web::web_proxy m_proxy;
494
508
495
509
bool m_implicit_grant;
496
510
bool m_bearer_auth;
0 commit comments