Skip to Content
Authenticated AppsUse env.MINIUP_USER
On this page

Use env.MINIUP_USER

env.MINIUP_USER represents the trusted current Site member inside a Site Members Function. Use this public Function runtime contract for authorization and personalization instead of trusting user or role values sent by the browser.

Read MINIUP_USER identity fields

FieldMeaning
idThe current member’s user identifier
emailThe member’s email information, when available
nameThe member’s display name, when available
roleThe member’s Site role: owner, admin, editor, or viewer
siteIdThe linked MiniUp Site identifier

The identity is supplied for Site Members Functions. Do not assume a Public or API Key Function receives a member identity. Display names and email addresses should not be treated as durable business authorization keys.

Use identity in a Function

  1. Link the Function to your Site with Site Members access.
  2. Read env.MINIUP_USER inside the request handler.
  3. Check the role and, where necessary, the record’s relationship to user.id.
  4. Return only the user information the frontend needs.
export default { async fetch(request, env) { const user = env.MINIUP_USER; if (!user) return Response.json({ error: "Sign in required" }, { status: 401 }); return Response.json({ user: { id: user.id, name: user.name || "Member", role: user.role } }); } };

Do not trust browser-supplied identity

A request body such as {"role":"owner"} is just user input. It does not change env.MINIUP_USER.role or grant permission. Use the trusted identity for every protected operation, even when the frontend previously loaded a bootstrap response.

env.MINIUP_USER · MINIUP_USER · identity · id · email · name · role · siteId