Skip to content
Sign-ups and approval

Sign-ups and approval

Who may create an account on a portal is its Sign-ups setting (the portal’s Sign-in tab, or space-env web-portal attach --approve):

Sign-upsWho gets an account
Invite onlyOnly people your service invites (Invitations), and people with a sign-up link it made.
The machine approves each sign-upAnyone, once your service approved them (below).
Anyone may sign upAnyone.
A portal's Sign-ups dialog, set to The machine approves each sign-up, with its Save button A portal's Sign-ups dialog, set to The machine approves each sign-up, with its Save button

Allowed email domains (the portal’s Sign-in tab) narrows every sign-up to addresses of those domains, a sign-up link’s too. Invites skip it.

No unconfirmed accounts

An account exists only once its email is proven: by the link in a confirmation mail, a verified Google or Microsoft address, a magic link or an invite link. A password sign-up mails a confirmation link; the account, with the password chosen at sign-up, is made when the person opens it and presses Confirm and create account. The form always says “Check your mail”: an address that already has an account gets a “you already have one” mail instead, so the page tells nobody which addresses have accounts. Your service never sees anyone whose email isn’t proven.

Email me a link (the Sign-in tab) adds magic links: the sign-in page mails a 15-minute link that signs in, or, for an address without an account on a portal that takes its sign-up, creates the account. With password sign-in off it is a passwordless portal. Forgot password? mails a one-hour reset link; a new password signs out every other session of the account. Signed-in users manage their password and two-factor at /_portal/account: link to it from your app.

The approval call

The one endpoint your service exposes for the portal. When someone signs up on a portal whose sign-ups the machine approves, and for every invite and sign-up link whatever the setting, the auth service asks your service first, with the sub the account will get, and creates the account only once you approved:

POST /.well-known/agentspaces/web-portal/v1/signup
x-agentspaces-identity: <kind: "service">
content-type: application/json

{"v": 1, "sub": "01a1c587-7d4e-…", "email": "ada@example.com", "via": "password",
 "locale": "nl"}

locale is the language the sign-up page spoke (Languages): the welcome mail you send can speak it too.

via is how the account comes: password, magic_link, google, microsoft, agentspaces (a member of the organization the portal belongs to; Sign in with AgentSpaces) or invite. Approve every agentspaces sign-up to let your team in without a list. A portal open to anyone with an AgentSpaces account doesn’t ask about those: they get in without approval. A sign-up with an invite or a sign-up link of yours carries it, with the data you gave it:

{"v": 1, "sub": "…", "email": "ada.work@example.com", "via": "invite",
 "invite": {"id": "01a1…", "email": "ada@example.com", "data": {"role": "admin"}}}

{"v": 1, "sub": "…", "email": "bob@example.com", "via": "password",
 "signup_link": {"id": "01a2…", "data": {"workspace": "w1"}}}

An invite accepted with Google or Microsoft may come with another address than the one you invited (the account takes the provider’s verified one): email is the account’s, invite.email the invited one.

Answer 200 with JSON:

{"approved": true}

or

{"approved": false, "reason": "Only example.com addresses may sign up."}

Rules:

  • Accept it only with kind == "service". A signed-in user must not be able to call it.
  • reason is shown to the person signing up. Write it for them.
  • Anything else is a rejection: another status, a body that isn’t that JSON, or no answer within 60 seconds. No account is created and the person sees “sign-up is not available right now”. The auth service resumes a suspended machine first; resuming counts towards the 60 seconds. The confirmation, magic or invite link keeps working, so the person can try again.
  • This is the only time you learn the email. It is trimmed and lowercased. Store it with sub if you need it later (to show it, to mail the user); the auth service keeps no email address, only a keyed hash.
  • Make it idempotent on sub. Each attempt to sign up gets a new sub. If the auth service fails after you approved (the person closed the page, or signed up twice at once), no account has that sub and the next attempt comes with a new one: a record you stored for the old one is never used.
  • Ignore fields you don’t know. v stays 1 while fields are added.

A portal set to Anyone may sign up calls this endpoint only for invites and sign-up links. Your service otherwise first meets a user with an unknown sub on an ordinary request: create the user on first sight, without an email.

Last updated on