invite-with-password
Skill9 starsChanged 28 days agoMITView on GitHub
Build an app-owned account UI — your own sign-up/login form and your own password setup and reset — instead of handing users to platform auth pages and platform emails. Use when the app invites people in (addOrgUser / createAppMagicLink) and they must end up with a password they chose: the invitee sets it inside your form (needsInitialPassword + setFusebaseInitialPassword) and signs in with loginFusebaseUser, no 'Trying to reset your password?' email in the middle.
- Reads credentials
- Sends data out
In this repository119 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/fusebase-flow-always.mdcCursor rule
- .cursor/rules/fusebase-flow-implementation.mdcCursor rule
- .cursor/rules/fusebase-flow-security.mdcCursor rule
- .cursor/rules/fusebase-flow-specs.mdcCursor rule
- .cursor/rules/fusebase-flow-validation.mdcCursor rule
- api-explorationSkill
- app-api-contract-testingSkill
- app-backendSkill
- app-business-docsSkill
- app-dev-practicesSkill
- app-e2e-testsSkill
- app-quality-patternsSkill
- app-routingSkill
- app-secretsSkill
- app-sidecarSkill
- app-ui-designSkill
- business-logic-guardianSkill
- client-vs-internalSkill
- code-reviewSkill
- comment-policySkill
- communicationSkill
- design-discovery-ideationSkill
- dev-debug-logsSkill
- documentation-budgetSkill
- file-uploadSkill
- find-wasted-codeSkill
- find-wasted-effortSkill
- fusebase-cliSkill
- fusebase-dashboardsSkill
- fusebase-flow-health-checkSkill
- fusebase-gateSkill
- fusebase-portal-specific-appsSkill
- git-history-diagnosticSkill
- git-workflowSkill
- handling-authentication-errorsSkill
- handoffSkill
- implementation-planningSkill
- lightweight-laneSkill
- liveness-disciplineSkill
- managed-integrationsSkill
- mcp-gate-debugSkill
- module-size-disciplineSkill
- north-starSkill
- phase-auditSkill
- product-apps-decompositionSkill
- product-docs-firstSkill
- product-ownerSkill
- project-onboardingSkill
- release-deploy-reportingSkill
- remote-logsSkill
- repo-onboarding-context-mapSkill
- requirements-specificationSkill
- role-disciplineSkill
- security-permissions-reviewSkill
- skill-authoringSkill
- smoke-testingSkill
- task-delegationSkill
- The first 60 shown.
The file
Files
Invite With Password
When to use this
The app owns its account UI: a custom login form, a custom onboarding screen, its own password setup and reset — the user never leaves the app and never sees a Fusebase auth page. Typical asks: "invite my clients into the portal app", "our own branded sign-in", "let them pick a password when they accept the invite".
Without this, an invited user has no password they know, so the only way in is the platform's
"Trying to reset your password?" email — nonsense for somebody who never registered, and it drops
them onto a platform page in the middle of your onboarding. setFusebaseInitialPassword is what
makes an app-owned form possible: the invitee sets their first password inside the app.
The reset half of app-owned auth is a different op: requestFusebaseRestoreKey mints a restore
key without sending the platform email, so the app can send its own branded reset mail — see
fusebase-gate/references/fusebase-auth.md § Password Restore. This skill covers the first
password only.
Flow
Invite → invitee opens the app through the magic link → app shows a Create your password form → the account signs in with email + password from then on. No platform email beyond the invite itself.
Both pre-provisioning paths — addOrgUser (orgRole: 'client', autoConfirmClientInvite: true) and
createAppMagicLink (addToAccessPrincipals: true) — create an account holding a random password the
user never learns, which is why the invitee needs setFusebaseInitialPassword to get one they know.
- Invite — app backend,
process.env.FBS_FEATURE_TOKEN:addOrgUserorcreateAppMagicLink. - Open — invitee clicks the link, the platform activates it, the app host gets the invitee's
fbsfeaturetoken. Do the mandatory magic-link exchange first (fusebase-gate/references/fusebase-auth.md). - Detect — SPA reads
needsInitialPasswordfrom/auth/context.true= this account has never had a password → render the password form. Absent/false→ do not offer it. - Set — app backend forwards the invitee's own token to Gate.
FBS_FEATURE_TOKENgets403. - Sign in right away — a
200mints no session and drops every existing session of the account, including the magic-link one, so log the user back in with the password from the same form.
// SPA — step 3
const ctx = await fetch('https://app-api.{FUSEBASE_HOST}/v4/api/auth/context', {
headers: { 'x-app-feature-token': appToken },
}).then((r) => (r.ok ? r.json() : {}))
if (ctx.needsInitialPassword) showCreatePasswordForm(ctx.user.email)
// App backend — steps 4 and 5, on POST /api/account/set-initial-password
const GATE = 'https://app-api.{FUSEBASE_HOST}/v4/api/proxy/gate-service/v1'
const userToken = c.req.header('x-app-feature-token') || getCookie(c, 'fbsfeaturetoken')
const res = await fetch(`${GATE}/auth/fusebase/set-initial-password`, {
method: 'POST',
headers: { 'content-type': 'application/json', 'x-app-feature-token': userToken },
body: JSON.stringify({ password }),
})
if (res.status === 409) return c.json({ error: 'password_already_set' }, 409)
if (!res.ok) return c.json({ error: 'set_password_failed' }, 502)
// the magic-link session is gone now — sign in with the password we just set
const auth = new FusebaseAuthApi(createClient({ baseUrl: GATE })) // no token: visitor-safe op
const login = await auth.loginFusebaseUser({ body: { email, password } })
if (login.status === 'challenge_required') return handleChallenge(login.challenge)
// set login.session.sessionId as the app-domain cookie, then redirect to login.redirectPathLimits
- One-shot. A second call returns
409witherrorCode: fusebase_password_already_set. That means the account already has a password its user chose — route to sign-in or password restore, never retry. - Acts on the caller only. The body is
{ password }; there is noemailand no:orgId, so an app can never target another account. Authz is identical togetMyOrgAccess— user context, no extra app grant. - Platform flag
password_invite. Off on the target backend →403. Keep password restore as the fallback path. - No SDK method yet —
@fusebase/fusebase-gate-sdkdoes not exposesetFusebaseInitialPasswordyet, so call the documented endpoint withfetch(the AGENTS.md "documented endpoint" exception). Switch toFusebaseAuthApi.setFusebaseInitialPasswordoncesdk_describeshows it. - Older accounts provisioned before the platform started marking password-less accounts report
needsInitialPassword: false; they use password restore.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

