Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/issue-571-portal-api-client-auth…
Browse files Browse the repository at this point in the history
…' into issue-571-portal-api-client-auth
  • Loading branch information
pkalita-lbl committed Jun 24, 2024
2 parents b8917cc + 3ad1619 commit d7c4f7a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nmdc_runtime/site/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ class NmdcPortalApiClient:
access_token_expires_at: Optional[datetime] = None

def _request(self, method: str, endpoint: str, **kwargs):
r"""
Submits a request to the specified API endpoint;
after refreshing the access token, if necessary.
"""
if self.access_token is None or datetime.now() > self.access_token_expires_at:
refresh_response = requests.post(
f"{self.base_url}/auth/refresh",
Expand Down

0 comments on commit d7c4f7a

Please sign in to comment.