DocumentationMethacore Apps

External apps & SDK

11 min read · last updated 23 September 2026

An external app is your own web app – HTML, React, Next.js, whatever – at your own address. Methacore loads it in an iframe in the dashboard and in a WebView in the member app. With @methacore/sdk it signs in, calls the APIs, uses app storage and exports files.

Hosted apps from the Studio do not need the SDK. It is intended exclusively for external apps.

Prerequisites

WhatRule
Addresshttps:// only, with a valid certificate
Domainthe address's host must be one of the project's authorised domains in the Artim Developer Portal
Embeddingyour page must allow embedding in the dashboard (https://admin.methacore.de) – no X-Frame-Options: DENY, and if you set frame-ancestors, the dashboard must be included
Listingin the Artim Developer Portal under Methacore App: type External, the address under "External address"
OAuth clienta client of the "Methacore Apps" API with your app's scopes

Installation

npm install @methacore/sdk

The package ships as an ES module and CommonJS, with types. There is no global build (<script>); use a bundler.

Getting started

import { createMethacore } from "@methacore/sdk";

export const mc = createMethacore({
  clientId: "cl_7d2e41a9",
  scopes: ["mc.me.profile:read", "mc.me.events:read"],
});

const profil = await mc.api.apps.me.profile();
const { items: termine } = await mc.api.apps.me.events();

createMethacore detects on its own where the app is running:

ModeWhenWhere the token comes from
Hostin the dashboard's iframe or in the member app's WebViewfrom the host via the bridge. The host handles consent – you do not build a login.
Standalonedirectly in the browser at your addressfrom the SDK itself: OAuth with PKCE against the Artim Developer Portal

mc.inHost() tells you which mode applies.

In the host

In the host, the SDK asks the host for context and token via postMessage. You do not have to trigger any of this yourself:

import { createMethacore, host } from "@methacore/sdk";

const mc = createMethacore({ clientId: "cl_7d2e41a9", scopes: ["mc.me.groups:read"] });

if (mc.inHost()) {
  const context = await host.context();
  // { organisation: { id, name }, user: { id, firstName }, theme, locale, target, endpoints }
  document.documentElement.dataset.theme = context.theme;
  host.on("theme", ({ theme }) => (document.documentElement.dataset.theme = theme));
}

const gruppen = await mc.api.apps.me.groups();
await host.toast(`${gruppen.items.length} Gruppen geladen`, "green");
CallMeaning
host.context()club, member, theme, language, platform and the addresses (endpoints)
host.token(scopes?)an access token, with consent if needed
host.toast(message, color?)notification in the host
host.navigate(path)switch to a page of the host
host.download({ filename, mime, base64 })download or share a file
host.close()close the app
host.on("theme", handler)the host's theme changes

The bridge is the same protocol that hosted apps use: messages { mc: 1, id, type, payload }, responses { mc: 1, id, ok, result | error }. Without a response, a request is aborted after 15 seconds.

In the dashboard, the iframe allows external apps scripts, forms, downloads, pop-ups and their own origin – so localStorage and cookies of your domain work. In the member app, whatever a WebView allows applies.

Standalone: sign-in with PKCE

If someone opens your app directly, it signs in on its own:

import { createMethacore, AuthError } from "@methacore/sdk";

const mc = createMethacore({
  clientId: "cl_7d2e41a9",
  scopes: ["mc.me.profile:read"],
  redirectUri: "https://app.example.de/callback",
});

// on /callback
if (location.pathname === "/callback") {
  await mc.auth.handleRedirect(); // checks state, exchanges code + verifier for tokens
  history.replaceState(null, "", "/");
}

try {
  const profil = await mc.api.apps.me.profile();
} catch (error) {
  if (error instanceof AuthError && error.code === "login_required") await mc.auth.login();
  else throw error;
}
MethodMeaning
auth.login()redirects to the Artim Developer Portal's consent page
auth.beginLogin()only returns the authorization URL, e.g. for your own button
auth.handleRedirect(url?)processes the return and stores the tokens
auth.getToken()a valid access token, renewed with the refresh token
auth.logout()forgets the tokens

By default, tokens are stored in localStorage under mc.sdk.token.<clientId>; use the storage option for your own storage. The client is public – there is no client secret in the browser.

Redirect URIs

  • In the host you do not need any: the host signs in via https://apps-run.methacore.de/oauth/callback, and the Artim Developer Portal allows this address for every client of the "Methacore Apps" API.
  • Standalone, the redirect URI must be on an authorised domain of the project and use https. For development, http://localhost and http://*.localhost are allowed.

Without redirectUri, the SDK uses the current page (origin and path).

Developing locally

import { configure } from "@methacore/sdk";

configure({
  authBase: "http://localhost:8000",               // Artim Developer Portal API
  apiBase: "http://{section}.api.localhost:8080/v1", // {section} is replaced, e.g. apps
  redirectUri: "http://localhost:3000/callback",
});

In the host, the addresses the host sends in the context always apply; configure only takes effect in standalone mode.

Requesting additional scopes

If the API responds with 403 and does not carry the <scope> scope, the SDK requests the scope:

  • in the host once via auth.token with reauthorize: true – the host shows "Extend access" – and retries the call once,
  • standalone with a new sign-in that requests the additional scope (the page is left in the process).

API client

await mc.api.apps.me.profile();        // Profile
await mc.api.apps.me.groups();         // { items: Group[] }
await mc.api.apps.me.events();         // { items: EventItem[] }
await mc.api.apps.me.trainingplans();
await mc.api.apps.me.competitions();
await mc.api.apps.me.membercard();     // { card: … | null }

await mc.api.apps.storage.list("notizen", { scope: "user", limit: 50 });
await mc.api.apps.storage.put("notizen", "n-1", { text: "Hallo" });

// any other Methacore API
await mc.api.request("members", "/members", { query: { limit: 20 } });

Errors come as ApiError with status, message and the response body. The available endpoints are listed under Developer API, storage under App storage.

Exports

await mc.exportRows(rows, {
  format: "xlsx",               // "csv" | "xlsx" | "pdf"
  filename: "teilnehmer",
  columns: [{ key: "name", label: "Name" }, { key: "gruppe", label: "Gruppe" }],
});

In the host, the file goes through the bridge (dashboard: download, mobile: share); standalone, it is a normal browser download. The SDK only loads xlsx and pdf-lib on the first export. Individually, there are mc.export.toCsv, toXlsx and toPdf.

The warning on first open

Methacore does not review external apps. That is why every member sees a notice on first open with the provider (name of your team in the Artim Developer Portal) and a link to the privacy policy – both from your project in the Artim Developer Portal. Consent to the permissions follows; only then does the host load your page. Methacore remembers the confirmation per member.

In the App Store, an external app carries the notice "External – not reviewed by Methacore" ("Extern – nicht von Methacore geprüft").

Daily check

Once a day, Methacore calls your app's address. If it does not respond over https with a valid certificate, the app is considered unreachable, and the store shows it as such until the next check succeeds. Addresses pointing to private or internal networks never pass the check.

Checklist

  • Address with https, valid certificate, domain authorised
  • Embedding by https://admin.methacore.de allowed
  • Client of the "Methacore Apps" API, scopes as narrow as possible
  • Privacy policy and terms of use stored in the Artim Developer Portal
  • Tested in the host (dashboard and, if target is mobile/both, mobile) and standalone