File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ async def _request_stream(
255255class TokenSource :
256256 class AccessTokenResponse (BaseModel ):
257257 access_token : str
258- token_type : str
258+ token_type : str = ""
259259 expires_in : int = 0
260260 refresh_token : str = ""
261261 scope : str = ""
@@ -501,12 +501,14 @@ async def _establish_connection_and_get_response(
501501 ):
502502 if with_token and self .token_source is not None :
503503 token_type , token = await self .token_source .fetch_token (log , self )
504- header_value = (
505- f"{ token_type } { token } "
506- if self .token_source .authorization_header
507- == DEFAULT_AUTHORIZATION_HEADER
508- else f"{ token } "
509- )
504+ if self .token_source .authorization_header == DEFAULT_AUTHORIZATION_HEADER :
505+ if not token_type :
506+ log .warning (
507+ "using default Authorization header without a token type prefix" ,
508+ )
509+ header_value = f"{ token_type } { token } " if token_type else token
510+ else :
511+ header_value = token
510512 headers [self .token_source .authorization_header ] = header_value
511513
512514 # Only pass timeout if explicitly provided. Otherwise, omit the
You can’t perform that action at this time.
0 commit comments