@@ -6,15 +6,16 @@ use crate::{
6
6
} ;
7
7
use oauth2:: {
8
8
basic:: { BasicClient , BasicTokenType } ,
9
- AuthUrl , ClientId , ClientSecret , EmptyExtraTokenFields , StandardTokenResponse , TokenUrl , EndpointNotSet , EndpointSet , RequestTokenError , StandardErrorResponse , HttpClientError
9
+ AuthUrl , ClientId , ClientSecret , EmptyExtraTokenFields , EndpointNotSet , EndpointSet ,
10
+ HttpClientError , RequestTokenError , StandardErrorResponse , StandardTokenResponse , TokenUrl ,
10
11
} ;
11
12
use std:: sync:: { Arc , Mutex } ;
12
13
use tokio:: task:: JoinHandle ;
13
14
14
15
type Token = StandardTokenResponse < EmptyExtraTokenFields , BasicTokenType > ;
15
16
16
-
17
- type MyOAuthClient = BasicClient < EndpointSet , EndpointNotSet , EndpointNotSet , EndpointNotSet , EndpointSet > ;
17
+ type MyOAuthClient =
18
+ BasicClient < EndpointSet , EndpointNotSet , EndpointNotSet , EndpointNotSet , EndpointSet > ;
18
19
19
20
/// Configuration for the OAuth2 client.
20
21
#[ derive( Debug , Clone , FromEnv ) ]
@@ -105,7 +106,15 @@ impl Authenticator {
105
106
}
106
107
107
108
/// Requests a new authentication token and, if successful, sets it to as the token
108
- pub async fn authenticate ( & self ) -> Result < ( ) , RequestTokenError < HttpClientError < reqwest:: Error > , StandardErrorResponse < oauth2:: basic:: BasicErrorResponseType > > > {
109
+ pub async fn authenticate (
110
+ & self ,
111
+ ) -> Result <
112
+ ( ) ,
113
+ RequestTokenError <
114
+ HttpClientError < reqwest:: Error > ,
115
+ StandardErrorResponse < oauth2:: basic:: BasicErrorResponseType > ,
116
+ > ,
117
+ > {
109
118
let token = self . fetch_oauth_token ( ) . await ?;
110
119
self . set_token ( token) ;
111
120
Ok ( ( ) )
@@ -127,7 +136,15 @@ impl Authenticator {
127
136
}
128
137
129
138
/// Fetches an oauth token
130
- pub async fn fetch_oauth_token ( & self ) -> Result < Token , RequestTokenError < HttpClientError < reqwest:: Error > , StandardErrorResponse < oauth2:: basic:: BasicErrorResponseType > > > {
139
+ pub async fn fetch_oauth_token (
140
+ & self ,
141
+ ) -> Result <
142
+ Token ,
143
+ RequestTokenError <
144
+ HttpClientError < reqwest:: Error > ,
145
+ StandardErrorResponse < oauth2:: basic:: BasicErrorResponseType > ,
146
+ > ,
147
+ > {
131
148
let token_result = self
132
149
. client
133
150
. exchange_client_credentials ( )
0 commit comments