Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ohmayr committed Jul 17, 2024
1 parent 02991a8 commit 1cc12c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion google/auth/_credentials_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class _BaseCredentials(metaclass=abc.ABCMeta):
with modifications such as :meth:`ScopedCredentials.with_scopes`.
Attributes:
token (str): The bearer token that can be used in HTTP headers to make
token (Optional[str]): The bearer token that can be used in HTTP headers to make
authenticated requests.
"""

Expand Down
7 changes: 5 additions & 2 deletions google/auth/aio/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async def before_request(self, request, method, url, headers):


class StaticCredentials(Credentials):
"""Asynchronous Credentials using access tokens.
"""Asynchronous Credentials representing an immutable access token.
The credentials are considered immutable except the tokens which can be
configured in the constructor ::
Expand All @@ -100,7 +100,7 @@ class StaticCredentials(Credentials):
def __init__(self, token):
"""
Args:
token (str): The OAuth 2.0 or JWT access token.
token (str): The access token.
"""
super(StaticCredentials, self).__init__()
self.token = token
Expand All @@ -109,6 +109,8 @@ def __init__(self, token):
async def refresh(self, request):
raise exceptions.InvalidOperation("Static credentials cannot be refreshed.")

# Note: before_request should never try to refresh access tokens.
# StaticCredentials intentionally does not support it.
@_helpers.copy_docstring(Credentials)
async def before_request(self, request, method, url, headers):
await self.apply(headers)
Expand Down Expand Up @@ -139,3 +141,4 @@ async def apply(self, headers, token=None):

async def before_request(self, request, method, url, headers):
"""Anonymous credentials do nothing to the request."""
pass

0 comments on commit 1cc12c5

Please sign in to comment.