jfaustin's picture
add dockerfile and folding studio cli
44459bb
raw
history blame
600 Bytes
"""Headers for HTTP requests."""
from folding_studio.config import FOLDING_API_KEY
from folding_studio.utils.gcp import get_id_token
def get_auth_headers() -> dict[str, str]:
"""
Create authentication headers based on available credentials.
API key is the default authentication.
If none is provided, we fallback to JWT from Google Cloud.
Returns:
dict: Authentication headers for API requests.
"""
if FOLDING_API_KEY:
return {"X-API-Key": FOLDING_API_KEY}
identity_token = get_id_token()
return {"Authorization": f"Bearer {identity_token}"}