@@ -56,45 +56,6 @@ impl RunnableCmd for CmdAuth {
5656 }
5757}
5858
59- // Integrate reqwest with oauth2 until oauth2 is updated to support reqwest
60- // 0.13.
61- struct ReqwestClient < ' a > ( & ' a reqwest:: Client ) ;
62-
63- impl < ' a , ' c > oauth2:: AsyncHttpClient < ' c > for ReqwestClient < ' a > {
64- type Error = oauth2:: HttpClientError < reqwest:: Error > ;
65-
66- type Future = std:: pin:: Pin <
67- Box <
68- dyn std:: future:: Future < Output = Result < oauth2:: HttpResponse , Self :: Error > >
69- + Send
70- + Sync
71- + ' c ,
72- > ,
73- > ;
74-
75- fn call ( & ' c self , request : oauth2:: HttpRequest ) -> Self :: Future {
76- Box :: pin ( async move {
77- let response = self
78- . 0
79- . execute ( request. try_into ( ) . map_err ( Box :: new) ?)
80- . await
81- . map_err ( Box :: new) ?;
82-
83- let mut builder = http:: Response :: builder ( )
84- . status ( response. status ( ) )
85- . version ( response. version ( ) ) ;
86-
87- for ( name, value) in response. headers ( ) . iter ( ) {
88- builder = builder. header ( name, value) ;
89- }
90-
91- builder
92- . body ( response. bytes ( ) . await . map_err ( Box :: new) ?. to_vec ( ) )
93- . map_err ( oauth2:: HttpClientError :: Http )
94- } )
95- }
96- }
97-
9859/// Parse and normalize a given host string as a valid URL.
9960///
10061/// http(s) are the only supported schemas. If no schema is specified then
@@ -240,7 +201,7 @@ impl CmdAuthLogin {
240201 }
241202
242203 // Make the client for use by oauth2
243- let client = & ctx
204+ let client = ctx
244205 . client_config ( )
245206 . make_unauthenticated_client_builder ( )
246207 . redirect ( reqwest:: redirect:: Policy :: none ( ) )
@@ -272,7 +233,7 @@ impl CmdAuthLogin {
272233 request = request. add_extra_param ( "ttl_seconds" , ttl. as_secs ( ) . to_string ( ) ) ;
273234 }
274235
275- let reqwest_client = ReqwestClient ( client) ;
236+ let reqwest_client = oauth2_reqwest :: ReqwestClient :: from ( client) ;
276237
277238 let details: StandardDeviceAuthorizationResponse =
278239 request. request_async ( & reqwest_client) . await ?;
0 commit comments