in utils/metadata.py [0:0]
def authenticated_request(url: str, method: str) -> str:
"""Make a request with an ID token to a protected service
https://cloud.google.com/functions/docs/securing/authenticating#functions-bearer-token-example-python"""
auth_req = google.auth.transport.requests.Request()
id_token = google.oauth2.id_token.fetch_id_token(auth_req, url)
resp = requests.request(
method, url, headers={"Authorization": f"Bearer {id_token}"}
)
return resp.content