Ferdigheter · Tilgang og sikkerhet
Make an app members-only
Check whether an app is public, members-only or signs people in itself, have an owner change it, and read the signed-in person's email and name in the app.
An app on Skybu is public (anyone with the address), for members only, or signs people in itself. Members-only means Skybu's gateway asks people to sign in before the app shows, and passes the app who they are. Sign-in goes through Skybu, so for an organisation with single sign-on it is the organisation's Entra ID or Google Workspace account. The app needs no login code and the user registers no redirect address. This is the quickest way to put an internal tool behind the company's accounts.
When the app needs public pages next to signed-in ones, has to take webhooks, or wants a stable user id, roles or groups, the third mode fits better: the app runs OpenID Connect itself against the same accounts (skill://access/sign-in-with-your-organisation).
In short
get_app_accessto see what the app uses now.- If it should change, an owner changes it:
set_app_accesson an owner's connection, the dashboard, or the CLI. - If the app needs to know who is signed in, read the
x-skybu-user-emailandx-skybu-user-nameheaders, and only when the app is members-only.
Step 1: what the app uses now
{ "name": "get_app_access", "arguments": { "appId": "<app id>" } }
{ "access": null, "organisation": "public", "effective": "public", "allowed": null, "signIn": null }
| Field | Meaning |
|---|---|
access | The app's own setting: public, members, app, or null when it follows the organisation. |
organisation | The organisation's default for apps that follow it: public or members. |
effective | What applies now. This is the one that counts. |
allowed | The groups and people the app is limited to, or null for every member. |
signIn | Only when effective is app: the app's OpenID Connect client. |
New apps follow the organisation, and an organisation starts with public. A pull request preview has no setting of its own: it follows its app, so a members-only app's previews ask for sign-in too.
Step 2: changing it
Only owners of the organisation can change who may open an app. With an owner's connection and projects:write:
{ "name": "set_app_access", "arguments": { "appId": "<app id>", "access": "members" } }
access is public, members, app or inherit (follow the organisation). The answer is the same as get_app_access.
If the user is not an owner, the change is refused (owner_only); they need to ask one. On an installation where Skybu itself is not on HTTPS, members-only is refused with sign_in_needs_https rather than leaving the app open. Owners can also change it themselves:
- One app: the app's Settings tab, "Who can open the app" (nb: "Hvem kan åpne appen"), or
skybu app access <app> members. - The organisation's default: Settings → General, "Sign-in in front of apps". It changes every app that follows the organisation at once; apps with a setting of their own keep it. There is no agent tool for the default, and it is only public or members.
Recommend setting the app itself to members only rather than relying on the organisation's default. Then switching the default to public later does not open this app.
After the change, call get_app_access again and check that effective is members.
What visitors see
- Someone not signed in to Skybu is sent to sign in, then back to the page they asked for.
- A member of the organisation gets the app, without a consent page.
- A guest an owner invited to this app gets it too (
skill://access/guests-and-groups). - If the app is limited to some groups or people, other members get the "no access" page.
- Someone signed in who is not a member gets a "no access" page from Skybu, never the app.
- The sign-in lasts 15 minutes before the gateway checks again, so a person removed from the organisation loses the app within that time.
Anything that is not a person in a browser is stopped too: webhooks, other services calling the app's API, customers without an account in the organisation. An app that must take such calls has to stay public.
Step 3: who is signed in
On a members-only app, every request that reaches the app carries two headers set by the gateway:
| Header | Value |
|---|---|
x-skybu-user-email | The member's email. |
x-skybu-user-name | The member's name. |
A visitor cannot set these on a members-only app: the gateway writes them from the sign-in. A public app gets none of this, and there anyone can send these headers with any value. So the app must only trust them when it requires sign-in. Check effective is members before you write code that relies on them, and have the app refuse a request without them rather than treat it as anonymous.
Express:
app.use((req, res, next) => {
const email = req.get("x-skybu-user-email");
if (!email) return res.status(401).send("Sign-in required");
req.user = { email, name: req.get("x-skybu-user-name") ?? email };
next();
});
app.get("/me", (req, res) => res.json(req.user));
Next.js (App Router, a server component or route handler):
import { headers } from "next/headers";
export default async function Page() {
const h = await headers();
const email = h.get("x-skybu-user-email");
if (!email) return <p>Sign-in required</p>;
return <p>Signed in as {h.get("x-skybu-user-name") ?? email}</p>;
}
Use the email as the person's key, for example to look up their rows in the app's database (skill://databases/use-the-database).
Things to know
- Other pods in the same project, previews included, cannot call a members-only app directly with headers of their own; only the gateway reaches it.
- Custom domains (
skill://domains/custom-domain) ask for sign-in too. - Every change of access, for an app or the organisation, is in the audit log.
- An owner can limit the app to groups from Entra ID (through SCIM) or chosen members, and invite guests from outside the organisation:
skill://access/guests-and-groups. Previews follow their app's limits. - For adding login to an app step by step, see
skill://playbooks/add-login.