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>"
ENGAGE_ACTIVITY_SLUG = "<activity SLUG>"
ORG_SLUG = "<organisation 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"]
)
)
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>"
ENGAGE_ACTIVITY_SLUG = "<activity SLUG>"
ORG_SLUG = "<organisation 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&page=participant"
width="100%"
height="1200"
style="border:none;"></iframe>
<iframe
src="https://engage.longenesis.com/en/sunshinehospital/partner_view?activitySlug=aabbcc&authCode=AABBCCDDEEFF001122&menu=false&page=admin"
width="100%"
height="1200"
style="border:none;"></iframe>