@@ -283,7 +283,7 @@ def authenticate_basic(self, username: Optional[str] = None, password: Optional[
283283
284284 # Switch to bearer based authentication in further requests.
285285 if jwt_conformance :
286- self .auth = BearerAuth (bearer = resp ["access_token" ])
286+ self .auth = BearerAuth (bearer = resp ["access_token" ], origin = "basic" )
287287 else :
288288 self .auth = BasicBearerAuth (access_token = resp ["access_token" ])
289289 return self
@@ -426,7 +426,7 @@ def _authenticate_oidc(
426426 # check for JWT bearer token conformance
427427 jwt_conformance = self .capabilities ().has_conformance (CONFORMANCE_JWT_BEARER )
428428 if jwt_conformance :
429- self .auth = BearerAuth (bearer = token )
429+ self .auth = BearerAuth (bearer = token , origin = "oidc" )
430430 else :
431431 self .auth = OidcBearerAuth (provider_id = provider_id , access_token = token )
432432 self ._oidc_auth_renewer = oidc_auth_renewer
@@ -738,7 +738,7 @@ def authenticate_bearer_token(self, bearer_token: str) -> Connection:
738738
739739 .. versionadded:: 0.38.0
740740 """
741- self .auth = BearerAuth (bearer = bearer_token )
741+ self .auth = BearerAuth (bearer = bearer_token , origin = "unknown" )
742742 self ._oidc_auth_renewer = None
743743 return self
744744
@@ -748,7 +748,7 @@ def try_access_token_refresh(self, *, reason: Optional[str] = None) -> bool:
748748 Returns whether a new access token was obtained.
749749 """
750750 reason = f" Reason: { reason } " if reason else ""
751- if isinstance (self .auth , OidcBearerAuth ) and self ._oidc_auth_renewer :
751+ if isinstance (self .auth , BearerAuth ) and self . auth . origin == "oidc" and self ._oidc_auth_renewer :
752752 try :
753753 self ._authenticate_oidc (
754754 authenticator = self ._oidc_auth_renewer ,
0 commit comments