Skip to content

fix: (DeclarativeOAuthFlow) - fix the bug when refresh_token is not provided from the test authentication #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading