diff --git a/cuenca/http/client.py b/cuenca/http/client.py index 1750432e..b8e989f9 100644 --- a/cuenca/http/client.py +++ b/cuenca/http/client.py @@ -41,7 +41,11 @@ def __init__(self): @property def auth(self) -> Optional[Tuple[str, str]]: - return self.basic_auth if all(self.basic_auth) else None + return ( + self.basic_auth + if all(self.basic_auth) and not self.jwt_token + else None + ) def configure( self, @@ -109,6 +113,9 @@ def request( if self.jwt_token.is_expired: self.jwt_token = Jwt.create(self) self.headers['X-Cuenca-Token'] = self.jwt_token.token + self.headers['Authorization'] = ( + f'Bearer {self.jwt_token.token}' + ) session.headers = self.headers # type: ignore resp = session.request( # type: ignore method=method, diff --git a/tests/http/test_client.py b/tests/http/test_client.py index bbcc0a0e..3675dd9a 100644 --- a/tests/http/test_client.py +++ b/tests/http/test_client.py @@ -36,7 +36,7 @@ def test_basic_auth_configuration(): def test_configures_jwt(): session = Session() session.configure(use_jwt=True) - assert session.auth + assert not session.auth assert session.jwt_token