import requests
AUTH_ENDPOINT = (
"https://auth.longenesis.com/realms/curator-engage/protocol/openid-connect/token"
)
USERNAME = "<your username>"
PASSWORD = "<your password>"
CLIENT_ID = "<Longenesis issued client id>"
CLIENT_SECRET = "<Longenesis issued client id>"
ORG_SLUG = "<your organisation slug>"
ENGAGE_ACTIVITY_SLUG = "<activity SLUG>"
REDIRECT_URL = (
"https://engage.longenesis.com/en/{ORG_SLUG}/partner_view?activitySlug={ENGAGE_ACTIVITY_SLUG}&authCode={code}"
)
access_token = requests.post(
AUTH_ENDPOINT,
data={
"username": USERNAME,
"password": PASSWORD,
"grant_type": "password",
"client_id": CLIENT_ID,
"client_secret": CLIENT_SECRET,
},
).json()["access_token"]
PERSON_DATA = {
"participant_id": "0000099",
"participant_full_name": "John Doe",
"guardian_id": "0007",
"guardian_full_name": "Jane Doe",
"free_text": ["Hello John!"],
}
response = requests.post(
f"https://engage-openapi.longenesis.com/get_auth_code",
json=PERSON_DATA,
headers={"Authorization": f"Bearer {access_token}"},
)
print(
REDIRECT_URL.format(
slug=ENGAGE_ACTIVITY_SLUG, code=response.json()["authorization_code"]
)
)
"person_id":"same_as_participant_id",
"org_level": ["perm1", "perm2", ...],
"projects": {
"project_slug1": ["perm1", "perm2", ...],
"project_slug2": ["perm1", ...],
}
}
"person_id":"same_as_participant_id",
"org_level": ["MA", "CRP", "MC", "MP", "SR", "SW", "SD"],
"projects": {}
}
import requests
AUTH_ENDPOINT = (
"https://auth.longenesis.com/realms/curator-engage/protocol/openid-connect/token"
)
USERNAME = "<your username>"
PASSWORD = "<your password>"
CLIENT_ID = "<Longenesis issued client id>"
CLIENT_SECRET = "<Longenesis issued client id>"
ORG_SLUG = "<your organisation slug>"
ENGAGE_ACTIVITY_SLUG = "<activity SLUG>"
REDIRECT_URL = (
"https://engage.longenesis.com/en/{ORG_SLUG}/partner_view?activitySlug={ENGAGE_ACTIVITY_SLUG}&authCode={code}"
)
access_token = requests.post(
AUTH_ENDPOINT,
data={
"username": USERNAME,
"password": PASSWORD,
"grant_type": "password",
"client_id": CLIENT_ID,
"client_secret": CLIENT_SECRET,
},
).json()["access_token"]
PERSON_DATA = {
"participant_id": "0000099",
"participant_full_name": "John Doe"
"guardian_full_name": "Jane Doe",
"free_text": ["Hello John!"],
"org_slug": "sunshinehospital",
}
response = requests.post(
f"https://engage-openapi.longenesis.com/get_auth_code",
json=PERSON_DATA,
headers={"Authorization": f"Bearer {access_token}"},
)
print(
REDIRECT_URL.format(
slug=ENGAGE_ACTIVITY_SLUG, code=response.json()["authorization_code"]
)
)
<iframe
src="https://engage.longenesis.com/en/sunshinehospital/partner_view?activitySlug=aabbcc&authCode=AABBCCDDEEFF001122&menu=false"
width="100%"
height="1200"
style="border:none;"></iframe>
import requests
AUTH_ENDPOINT = (
"https://auth.longenesis.com/realms/curator-engage/protocol/openid-connect/token"
)
USERNAME = "<your username>"
PASSWORD = "<your password>"
CLIENT_ID = "<Longenesis issued client id>"
CLIENT_SECRET = "<Longenesis issued client id>"
SESSION_ID = "...load the session_id from the place you stored it..."
access_token = requests.post(
AUTH_ENDPOINT,
data={
"username": USERNAME,
"password": PASSWORD,
"grant_type": "password",
"client_id": CLIENT_ID,
"client_secret": CLIENT_SECRET,
},
).json()["access_token"]
response = requests.post(
f"https://engage-openapi.longenesis.com/invalidate/{SESSION_ID}",
headers={"Authorization": f"Bearer {access_token}"},
)
print(response.json())