Skip to content

Commit

Permalink
fix assertion client for httpx
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed Oct 18, 2021
1 parent 4d8a6ef commit fca7f85
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions authlib/integrations/httpx_client/assertion_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from httpx import AsyncClient, Client
from httpx import AsyncClient, Client, USE_CLIENT_DEFAULT
try:
from httpx._config import UNSET
except ImportError:
Expand All @@ -9,7 +9,7 @@
from .utils import extract_client_kwargs
from .oauth2_client import OAuth2Auth

__all__ = ['AsyncAssertionClient']
__all__ = ['AsyncAssertionClient', 'AssertionClient']


class AsyncAssertionClient(_AssertionClient, AsyncClient):
Expand All @@ -35,7 +35,7 @@ def __init__(self, token_endpoint, issuer, subject, audience=None, grant_type=No

async def request(self, method, url, withhold_token=False, auth=None, **kwargs):
"""Send request with auto refresh token feature."""
if not withhold_token and auth is UNSET:
if not withhold_token and auth is USE_CLIENT_DEFAULT:
if not self.token or self.token.is_expired():
await self.refresh_token()

Expand Down Expand Up @@ -80,7 +80,7 @@ def __init__(self, token_endpoint, issuer, subject, audience=None, grant_type=No

def request(self, method, url, withhold_token=False, auth=None, **kwargs):
"""Send request with auto refresh token feature."""
if not withhold_token and auth is UNSET:
if not withhold_token and auth is USE_CLIENT_DEFAULT:
if not self.token or self.token.is_expired():
self.refresh_token()

Expand Down

0 comments on commit fca7f85

Please sign in to comment.