Skip to content

Commit

Permalink
Moving token to post for tokeninfo call
Browse files Browse the repository at this point in the history
  • Loading branch information
sai-sunder-s committed Sep 22, 2022
1 parent 96bba68 commit 8dcc05e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion google/auth/compute_engine/_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,5 +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"])
_LOGGER.debug("Received token with expiry: %s, %s", token_expiry, token_json["expires_in"])
return token_json["access_token"], token_expiry
8 changes: 4 additions & 4 deletions google/auth/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ def apply(self, headers, token=None):
if self.expiry is None:
_LOGGER.debug("expiry is none")
elif _helpers.utcnow() >= self.expiry - datetime.timedelta(seconds=600):
token_info_response = requests.get(
"https://oauth2.googleapis.com/tokeninfo?access_token={}".format(
self.token
)
token_info_response = requests.post(
"https://oauth2.googleapis.com/tokeninfo",
data = {"access_token": self.token}
)

token_expires_in = 10000
if token_info_response.status_code == 200:
parsed_json = token_info_response.json()
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.2-dev2"
__version__ = "2.11.2-dev3"

0 comments on commit 8dcc05e

Please sign in to comment.