File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -120,14 +120,17 @@ impl RmcpClient {
120120 url : & str ,
121121 bearer_token : Option < String > ,
122122 ) -> Result < Self > {
123- let initial_tokens = match load_oauth_tokens ( server_name, url) {
124- Ok ( tokens) => tokens,
125- Err ( err) => {
126- warn ! ( "failed to read tokens for server `{server_name}`: {err}" ) ;
127- None
128- }
123+ let initial_oauth_tokens = match bearer_token {
124+ Some ( _) => None ,
125+ None => match load_oauth_tokens ( server_name, url) {
126+ Ok ( tokens) => tokens,
127+ Err ( err) => {
128+ warn ! ( "failed to read tokens for server `{server_name}`: {err}" ) ;
129+ None
130+ }
131+ } ,
129132 } ;
130- let transport = if let Some ( initial_tokens) = initial_tokens . clone ( ) {
133+ let transport = if let Some ( initial_tokens) = initial_oauth_tokens . clone ( ) {
131134 let ( transport, oauth_persistor) =
132135 create_oauth_transport_and_runtime ( server_name, url, initial_tokens) . await ?;
133136 PendingTransport :: StreamableHttpWithOAuth {
@@ -137,7 +140,7 @@ impl RmcpClient {
137140 } else {
138141 let mut http_config = StreamableHttpClientTransportConfig :: with_uri ( url. to_string ( ) ) ;
139142 if let Some ( bearer_token) = bearer_token {
140- http_config = http_config. auth_header ( format ! ( "Bearer { bearer_token}" ) ) ;
143+ http_config = http_config. auth_header ( bearer_token) ;
141144 }
142145
143146 let transport = StreamableHttpClientTransport :: from_config ( http_config) ;
You can’t perform that action at this time.
0 commit comments