Skip to the page
Docs articles

Sign people in on your board

Send your board's sign-in to your own sign-in page, or sign people in as they arrive from your product, with the token your server already signs.

Last updated

View as Markdown
On this page

Your board signs people in with an emailed link, Google or GitHub. If your product has its own accounts, your board can use them instead, so the people who vote and comment are the people your product knows. Choose how under Settings (opens Notert in a new tab), then Customer login (opens Notert in a new tab). Choose how customers sign in to your board walks your team through that page.

  • Default signs people in on the board itself.
  • Single sign-on sends them to your own sign-in page, and they come back signed in.
  • Off takes no sign-ins on the board. People can still read it, and while Guest submissions is on, post, vote and comment as guests. See guests.

Automatic login, beside them, signs people in as they open your board from your product, where they're already signed in. It works with any of the three, and where your product already identifies its users in the widget, it needs nothing more from your server.

What it needs

Single sign-on and automatic login come with plans that include board sign-in through your site, and need two things first. The Customer login page says while your domain is still missing. If your plan stops including them, they pause and your board uses its own sign-in, and they pick up again, with the people still signed in, once your plan includes them again.

Your server signs the token as it does for the widget (see sign a token on your server), with two more claims, since a token for the board travels in an address:

  • aud set to notert:board, so a widget's token never signs anyone in on your board, and a board's never works in the widget.
  • iat, when you signed it, with an exp no more than 10 minutes after it.

A token for the board may carry the traits, picture and companies your widget's token does (see sign a token on your server), which signing in keeps, so someone who only ever signs in on your board has theirs too. The widget's own links carry their companies for you, and the widget keeps their traits as they load your pages.

The board signs in the person your token's sub names, as an account of their own on your board, and never a Notert account by the address. Emails about what they post go to the address, so sign email_verified: true only for an address your product has confirmed. Someone signed in on your board with a Notert account under the same address, by link, Google or GitHub, who presses Sign in and comes back from your sign-in page, becomes that account to your board, which your links then sign in.

Each token signs someone in once, so sign a new one for every link and every return from your sign-in page.

Turning single sign-on and automatic login off, or revoking your identity secret, signs out everyone your site signed in on the board.

Someone your site signs in is a visitor on your board, even one of your teammates. Under single sign-on or Off, your teammates still sign in as the team with their own Notert account: the board's sign-in step has "On the team? Sign in here", at the foot of every page of your board and on its sign-in step, which sends a link only to your team's addresses.

Single sign-on

  1. Under Board login, choose Single sign-on.

  2. Enter the address of your sign-in page, such as https://acme.com/login, and press Turn on. To change it later, press the Sign-in page field. To remove it, choose another Board login first.

  3. On that page, read the redirect the board passes it. Once the person is signed in, send them to that address with their token added as token:

    const back = new URL(request.query.redirect);
    if (back.hostname !== "feedback.acme.com") throw new Error("Not our board");
    back.searchParams.set("token", token);
    response.redirect(back.href);

They land back on the page they were on, and whatever they pressed before signing in, such as a vote, goes ahead. Check that redirect is your board's own domain before you send anyone there.

A fuller sketch in Express, for someone already signed in to your product and for someone who signs in first:

import { SignJWT } from "jose";

const BOARD = "https://feedback.acme.com";

function signBoardToken(user) {
  return new SignJWT({
    email: user.email,
    ...(user.name ? { name: user.name } : {}),
    email_verified: true,
  })
    .setProtectedHeader({ alg: "HS256" })
    .setSubject(String(user.id))
    .setAudience("notert:board")
    .setExpirationTime("10m")
    .setIssuedAt()
    .sign(new TextEncoder().encode(process.env.NOTERT_IDENTITY_SECRET));
}

// Sends the person back to the board signed in, or answers false for an address that isn't it.
async function backToBoard(res, redirect, user) {
  const back = new URL(redirect);
  if (back.origin !== BOARD) return false;
  back.searchParams.set("token", await signBoardToken(user));
  res.redirect(back.href);
  return true;
}

app.get("/login", async (req, res) => {
  // Already signed in to your product: straight back to the board.
  if (req.user && req.query.redirect && (await backToBoard(res, req.query.redirect, req.user)))
    return;
  res.render("login", { redirect: req.query.redirect });
});

app.post("/login", async (req, res) => {
  const user = await signIn(req.body.email, req.body.password);
  if (req.body.redirect && (await backToBoard(res, req.body.redirect, user))) return;
  res.redirect("/dashboard");
});

Your sign-in form carries redirect along in a hidden field, so it survives the post.

Automatic login

Turn on Automatic login, then Sign in from widget links beside it. Then, on any page where the widget runs and your product has named its signed-in user, a plain link to your board signs them in, with nothing more to build:

<a href="https://feedback.acme.com/roadmap">Roadmap</a>

The widget sees the press, gets a sign-in for the person it already knows from Notert, good for one minute and one use, and opens the page the link names. A link to your board's own domain or to its address on Notert signs them in alike, and so does one pressed after your page names its user. A press with Ctrl, Cmd or Shift held, a link meant for another frame, and a page with no signed-in user follow the link as it is.

It's off until you turn it on, since the widget's token sits in your page for up to a day: anyone who copies a person's token from their browser could sign in as them on your board until it expires. Sign widget tokens to last as little as your product allows, and use the server link below if that matters more to you.

From a page without the widget

From an email, or a page where the widget doesn't run, link to your board through an address on your own server that signs the token when it's pressed, and sends the person on to the board's sign-in address with it and the page to open:

https://feedback.acme.com/api/auth/sign-in/site?token=TOKEN&callbackURL=/roadmap

For example, a link to /feedback on your product, answered by your server:

app.get("/feedback", (request, response) => {
  const board = new URL("https://feedback.acme.com/api/auth/sign-in/site");
  board.searchParams.set("token", signBoardToken(request.user));
  board.searchParams.set("callbackURL", "/roadmap");
  response.redirect(board.href);
});

Sign the token at the press, not as your page draws the link: a token lasts 10 minutes, and a page left open longer would send a token that no longer works. Without a signed-in person, link to the board as usual.

The first time someone arrives this way in a browser that isn't signed in on your board yet, or whose sign-in your board no longer accepts, such as one from before you revoked your identity secret, the board shows who your link names and asks them to press Continue as with their name. Any page can send a browser a link, so this keeps someone else's link from signing them in as another person. Once they're signed in, later links from your product open the board straight away.

If it doesn't sign them in

The board opens its sign-in step, says it couldn't sign them in and what they can do, and names why in the address as error:

errorWhat it means
SITE_TOKEN_MALFORMEDThe token isn't a JWT the board reads, or a claim it needs is missing or the wrong type
SITE_TOKEN_ALGORITHMIt isn't signed with HS256
SITE_TOKEN_SIGNATUREIt isn't signed with your current identity secret
SITE_TOKEN_UNVERIFIED_EMAILIt doesn't say email_verified: true
SITE_TOKEN_EXPIREDIts exp has passed
SITE_TOKEN_ISSUED_AHEADIts iat is in the future
SITE_TOKEN_AUDIENCEIt doesn't name aud: "notert:board", such as a widget's token
SITE_TOKEN_TOO_LONGIts exp is more than 10 minutes after its iat
SITE_TOKEN_USEDIt signed someone in already
SITE_SIGN_IN_STATESingle sign-on came back to another browser than the one that pressed Sign in, or after 15 minutes
SITE_SIGN_IN_OFFThe board takes no sign-ins from your site now, or the address isn't your board's own domain
SITE_SIGN_IN_BUSYToo many sign-ins at once from one address, or for one person
SITE_ACCOUNTS_LIMITEDYour board has made as many new accounts as it may today
SITE_SECRET_UNREADABLENotert can't read your identity secret. Revoke it under Secrets and sign with the new one
SITE_SIGN_IN_REFUSEDThe sign-in couldn't start for another reason

A few other things that look like a failure:

  • Single sign-on still shows the board's own sign-in. Your plan doesn't include it now, or your board isn't on your own domain yet. The Customer login page says which.
  • A link from your product doesn't sign them in. The page's widget hasn't named its user yet, the link points somewhere other than your board's own domain, or Automatic login is off.
  • Someone is asked to press Continue as on every link. Their browser isn't keeping your board's sign-in, such as in a private window. Once it does, later links open the board straight away.
  • A token that works in the widget fails on the board. A widget's token has no aud: "notert:board" and lasts up to a day; sign one for the board as above.

Start here

Up and down arrowsto moveEnterto openEscto close