Skip to content

Commit

Permalink
fix: (DeclarativeOAuthFlow) - fix the bug when refresh_token is not…
Browse files Browse the repository at this point in the history
… provided from the `test` authentication (#186)
  • Loading branch information
bazarnov authored Dec 22, 2024
1 parent ae1211f commit cf93e3a
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,13 @@ def __call__(self, request: requests.PreparedRequest) -> requests.PreparedReques

def get_auth_header(self) -> Mapping[str, Any]:
"""HTTP header to set on the requests"""
token = (
self.access_token
if (
not self.get_token_refresh_endpoint()
or not self.get_refresh_token()
and self.access_token
)
else self.get_access_token()
)
token = self.access_token if self._is_access_token_flow else self.get_access_token()
return {"Authorization": f"Bearer {token}"}

@property
def _is_access_token_flow(self) -> bool:
return self.get_token_refresh_endpoint() is None and self.access_token is not None

def get_access_token(self) -> str:
"""Returns the access token"""
if self.token_has_expired():
Expand Down

0 comments on commit cf93e3a

Please sign in to comment.