Skip to content

Commit

Permalink
fix: Add Debug logs while attaching token to request
Browse files Browse the repository at this point in the history
  • Loading branch information
sai-sunder-s committed Sep 20, 2022
1 parent 055f155 commit 430d061
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions google/auth/compute_engine/_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,5 @@ def get_service_account_token(request, service_account="default", scopes=None):
token_expiry = _helpers.utcnow() + datetime.timedelta(
seconds=token_json["expires_in"]
)
_LOGGER.debug("Received token with expiry: %s", token_json["expires_in"])
return token_json["access_token"], token_expiry
4 changes: 4 additions & 0 deletions google/auth/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@
"""Interfaces for credentials."""

import abc
import logging

import six

from google.auth import _helpers


_LOGGER = logging.getLogger(__name__)

@six.add_metaclass(abc.ABCMeta)
class Credentials(object):
"""Base class for all credentials.
Expand Down Expand Up @@ -109,6 +112,7 @@ def apply(self, headers, token=None):
headers["authorization"] = "Bearer {}".format(
_helpers.from_bytes(token or self.token)
)
_LOGGER.debug("Attached token with expiry:{} at {}".format(self.expiry, _helpers.utcnow()))
if self.quota_project_id:
headers["x-goog-user-project"] = self.quota_project_id

Expand Down
2 changes: 1 addition & 1 deletion google/auth/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "2.11.1"
__version__ = "2.11.2-dev1"

0 comments on commit 430d061

Please sign in to comment.