Skip to content

Open Klaris from your app

Your people can also open Klaris itself in their browser, already signed in, from a button in your app. There they find the same chats they had through your assistant, can download any file, and use the rest of Klaris their role allows.

It uses the same signed pass as signing in over MCP, sent to a different address. A Klaris admin switches it on for your app (Settings → Partner Apps → Open Klaris for its people), and sets how long the Klaris sign-in lasts (Sign-in length, 8 hours unless changed).

How it works

  1. The person presses your button. Your server signs a pass for them, exactly as for MCP.
  2. Your server sends it to Klaris and gets back a one-time link.
  3. Your app opens the link in the person's browser: a new tab, or a redirect.
  4. Klaris signs them in and opens the workspace's home page.
POST https://app.klarislabs.com/api/v1/partner-sign-in/login
Content-Type: application/json

{"token": "<the pass>"}
{
  "redirect_url": "https://app.klarislabs.com/sso/callback?code=…"
}
reply = httpx2.post(f"{KLARIS_URL}/api/v1/partner-sign-in/login", json={"token": sign_pass(person)}, timeout=5)
reply.raise_for_status()
open_in_browser = reply.json()["redirect_url"]   # send the person's browser here
const res = await fetch(`${KLARIS_URL}/api/v1/partner-sign-in/login`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ token: await signPass(person) }),
});
if (!res.ok) throw new Error(`Klaris refused the pass: ${res.status}`);
const { redirect_url } = await res.json();   // send the person's browser here
  • The link works once, within 60 seconds. Make it when the person presses the button, not ahead of time.
  • Open it in the person's own browser. Anyone who opens the link first is signed in as them.
  • If someone else was signed in to Klaris in that browser, the new sign-in replaces them.
  • A refused pass gets 401 with "We could not sign this person in.". The reasons are the same as for MCP (see When a swap or token is refused); your Klaris admin sees which. Up to 60 sign-ins a minute are accepted from one address.

Signing out

When the person signs out of your app, you may tell Klaris, with a fresh pass for them:

POST https://app.klarislabs.com/api/v1/partner-sign-in/logout
Content-Type: application/json

{"token": "<a new pass>"}

It answers {"ok": true}. Today it is recorded only: the person's Klaris sign-in lasts its set length, or until they sign out of Klaris.