Skip to main content

In the code below, what is the lifetime of the generated token (keycloak_token) or what is the maximum permitted number of requests by keycloak_token?


import requests

def get_keycloak(username: str, password: str) -> str:
data = {
"client_id": "cdse-public",
"username": "---",
"password": "---",
"grant_type": "password",
}
try:
r = requests.post("https://identity.dataspace.copernicus.eu/auth/realms/CDSE/protocol/openid-connect/token",
data=data,
)
r.raise_for_status()
except Exception as e:
raise Exception(
f"Keycloak token creation failed. Reponse from the server was: {r.json()}"
)
return r.json()["access_token"]

keycloak_token = get_keycloak("username", "password")

As previously said; This forum is a space specifically for Sentinel Hub services. For Copernicus Data Space Ecosystem questions, please use their Community Forum to ask your questions.


Okay sorry. These two different services can be sometimes confusing for me.


Reply