The source code to the civic tech project Öppna Skolplattformen.
Go to file
Johan Öbrink 3cd753bc28 Setting up package 2020-12-20 23:22:46 +01:00
lib Some linting 2020-12-20 23:15:39 +01:00
.babelrc.js Initial commit 2020-12-19 13:37:45 +01:00
.eslintrc.js Some linting 2020-12-20 23:15:39 +01:00
.gitignore feat: 🎸 Possibly first working version 2020-12-20 23:02:05 +01:00
.huskyrc Initial commit 2020-12-19 13:37:45 +01:00
LICENSE Initial commit 2020-12-19 11:37:37 +01:00
README.md feat: 🎸 Possibly first working version 2020-12-20 23:02:05 +01:00
jest.config.js feat: 🎸 Possibly first working version 2020-12-20 23:02:05 +01:00
package.json Setting up package 2020-12-20 23:22:46 +01:00
tsconfig.json Trying out axios 2020-12-20 20:58:52 +01:00
yarn.lock feat: 🎸 Possibly first working version 2020-12-20 23:02:05 +01:00

README.md

embedded-api

Since the proxy was blocked (and also deemed a bad idea by some), this is a reboot of the API running in process in the app(s).

How to use

Installing

npm i -S @skolplattformen/embedded-api or yarn add @skolplattformen/embedded-api

Calling

Import and init

import init from "@skolplattformen/embedded-api";

const api = init(fetch);

Login

api.on("login", () => {
  // keep going
});

const loginStatus = await api.login("YYYYMMDDXXXX");
loginStatus.on("PENDING", console.log("BankID app not yet opened"));
loginStatus.on("USER_SIGN", console.log("BankID app is open"));
loginStatus.on("ERROR", console.log("Something went wrong"));
loginStatus.on(
  "OK",
  console.log("BankID sign successful. Session will be established.")
);

Loading data

// List children
const children = await api.getChildren();

// Get calendar
const calendar = await api.getCalendar(children[0].id);