Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 3.89 KB

app-integration.md

File metadata and controls

41 lines (26 loc) · 3.89 KB

back

App Integration & API

Build Artefacts in public/ Directory

A static build of the apps is committed to this repository in the public/apps/ directory. In case of the webapp-schulverwaltung this happens automatically via a GitHub Actions Workflow. For the other apps the latest build has to be committed manually.

For more details see Deployment View.

Integration via iframe

The Evento Portal loads the apps in an <iframe> to ensure a proper separation of the runtime environment. For more details on this decision see ADR 2: App Integration via iframe.

To compensate the limitations of the <iframe> and setup communication between the Evento Portal and the app, each app has to include the public/scripts/iframe.js script in its index.html:

<body>
  <!-- App contents... -->
  <script src="../../scripts/iframe.js" type="module"></script>
</body>

App Routing

Apps can use client-side hash-routing, that means using the hash part of the URL to store application state. The Evento Portal ensures, that the hash part is mapped from the <iframe>'s URL to the browser URL and vice versa.

Evento Portal ↔ App API

An app can rely on the following information that is provided by the Evento Portal:

What Where Note
Access token sessionStorage.getItem("CLX.LoginToken") Value: quoted string ("ey...")
Access token (legacy) localStorage.getItem("CLX.LoginToken") Value: quoted string ("ey...")
⚠️ Should not be used since there are issues if the user opens different apps in various tabs. Read value from sessionStorage instead.
Access token expiration (legacy) localStorage.getItem("CLX.TokenExpire") Value: Unix timestamp in milliseconds when access token expires as string.
User's locale localStorage.getItem("uiCulture")
• Document's lang attribute (<html lang="de-CH">)
culture_info property in access token
Value: string of user's locale such as de-CH or fr-CH

⚠️ Important: Apps should only read, never update the provided values in session- or localStorage.

⚠️ Important: Note, that for historical reasons the tokens are stored including double quotes (older apps assume it to be a valid JSON string and execute JSON.parse on the value).