Docs

Build for Guide

Guide is a learning platform for schools. You build and register your app with your Northwork developer account; Guide handles review, test schools, Log in with Guide and the school data your app is allowed to see.

How it works

  1. Create an app on northwork.dev. Open Apps and create an app with its name, description, website, privacy policy, support email and the redirect URIs you'll use for Log in with Guide.
  2. Create a key with guide:access. On API keys, create a test key, choose your app, and tick the guide:access scope. Keys must be bound to an app to work with Guide.
  3. Connect to Northwork on Guide. On Guide for Developers, press Connect to Northwork. You'll come back here, choose the app and approve. Guide receives the app's details and your developer ID, never your key secrets.
  4. Try it in your test school. Guide gives you a test school with test teachers and students. Use your test key to sign them in and build against the Guide APIs with sample data only.
  5. Submit for review. When your app is ready, submit it on Guide. The Guide panel on your app's page here shows the review status, and any notes if changes are requested.
  6. Go live. Once approved, schools can install your app, and your live keys work for those schools.
Your app, its details and its keys live on northwork.dev. When you edit or delete a connected app here, Guide is updated automatically.

Test and live keys

KeyReaches
nw_test_…Only your Guide test school, with its test teachers and students. Use it while you build and during review.
nw_live_…Real schools that install your app, and only after Guide approves it. Before approval, live keys aren't accepted.

Both need the guide:access scope and must be bound to the app (you choose the app when you create the key). Revoking or rotating a key takes effect on Guide straight away. Keep keys on your server.

Log in with Guide

Log in with Guide is standard OpenID Connect with the authorization code flow. Use any certified OIDC client library and point it at Guide's discovery document:

curl https://guidelearning.org/.well-known/openid-configuration
  • Issuer: https://guidelearning.org
  • client_id: your app ID, nw_app_… (on the app's page)
  • client_secret: a guide:access key bound to that app: a test key for your test school, a live key for real schools
  • redirect_uri: must exactly match one of the app's redirect URIs (https, or http://localhost while developing)
  • Client authentication: client_secret_basic or client_secret_post. PKCE (S256) is supported and recommended.
  • Scopes: openid (required), profile (name), school, classes, and roster (teachers can list the students in their classes)
  • Tokens: ID tokens are signed with RS256 (keys at https://guidelearning.org/oauth/jwks). Access tokens last one hour and there are no refresh tokens: users relaunch your app from Guide.
import * as client from "openid-client"; // npm i openid-client

// client_id = your app ID, client_secret = a guide:access key bound to that app
const config = await client.discovery(
  new URL("https://guidelearning.org"),
  "nw_app_…",
  process.env.GUIDE_KEY, // nw_test_… while you build, nw_live_… after approval
);

// 1. Send the user to Guide
const verifier = client.randomPKCECodeVerifier();
const url = client.buildAuthorizationUrl(config, {
  redirect_uri: "https://example.com/auth/guide/callback", // one of your app's redirect URIs
  scope: "openid",
  code_challenge: await client.calculatePKCECodeChallenge(verifier),
  code_challenge_method: "S256",
  state: client.randomState(),
});

// 2. On your callback
const tokens = await client.authorizationCodeGrant(config, currentUrl, {
  pkceCodeVerifier: verifier,
  expectedState: savedState,
});
const claims = tokens.claims(); // sub identifies the user for your app; no email address

Launching from Guide

When a student or teacher opens your app from My apps in Guide, Guide sends them to your app's login URL with iss=https://guidelearning.org, login_hint and target_link_uri. Start a normal sign-in from there. If your app has no login URL, Guide redirects straight to your first redirect URI with a code and iss and no state, so accept that case on your callback.

Guide data API

The data API lives at https://guidelearning.org/api/v1 (me, schools, classes, classes/{id}/students). Call it with a user's Guide access token, or from your server with a guide:access key. Full reference: Guide developer docs.

Apps never receive email addresses. Identify users by the sub claim, which is stable for your app, and use the scopes listed in scopes_supported for anything else.

Webhooks from Guide

If you set a webhook URL on your app, Guide sends signed JSON events to it. The Guide-Signature header uses the same format as Northwork webhooks: t=<unix seconds>,v1=<hex>, where the hex is HMAC-SHA256 of "<t>.<raw body>" keyed with the webhook signing secret Guide gives you for the app. Verify against the raw body, reject timestamps more than five minutes old, and use the event id to ignore duplicates.

import crypto from "node:crypto";

// header = the Guide-Signature request header, rawBody = the body exactly as received
function verifyGuide(rawBody, header, secret, toleranceSec = 300) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  const t = Number(parts.t);
  if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false;
  const expected = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  const given = Buffer.from(parts.v1 ?? "");
  return given.length === expected.length && crypto.timingSafeEqual(Buffer.from(expected), given);
}

app.post("/guide/webhooks", express.text({ type: "*/*" }), (req, res) => {
  if (!verifyGuide(req.body, req.get("Guide-Signature"), process.env.GUIDE_WEBHOOK_SECRET)) return res.status(400).send("Invalid signature");
  const event = JSON.parse(req.body);
  // handle event.type, ignore event.id values you've already seen
  res.sendStatus(200);
});

Review status

Your app's page on northwork.dev shows where it stands with Guide:

  • Not connected: press Connect to Northwork on Guide for Developers.
  • Connected: build and test in your test school.
  • In review: Guide is reviewing your submission.
  • Approved: schools can install your app and your live keys work for them.
  • Changes requested: read the note, update your app and submit again.
  • Paused: your app can't reach schools for now; see Guide for Developers.