Skip to content
Trustaige Docs

Sign customers up with a button

Your Sign up button sends the usual sign-in request with prompt=create. Trustaige makes the passkey and opens the account; you file the new sub.

View as Markdown

Sign-up uses the request you already send for sign-in, with one more parameter. Your Sign up button adds prompt=create. Trustaige asks the person to create a passkey or use one they have, opens their account with you, and sends a code to your callback as it does for a sign-in.

You don’t make an offer or email a link, and Trustaige’s page runs its own checks. If your own form sends email before the passkey step, add HumanProof to it, as described in If your form asks for details first.

prompt=create is part of a published OpenID Connect standard, and most OpenID Connect libraries pass it through as it is.

Before you start

In the hub, go to CIAM → Apps and click Add customer sign-in. Prove your domain when asked, give the app its name, logo and redirect address, and click Add customer sign-in. The app’s page then shows the four values your app needs:

ValueWhere it goes
IssuerYour OpenID Connect library’s discovery URL (TRUSTAIGE_ISSUER)
Client IDTRUSTAIGE_CLIENT_ID
Client secretTRUSTAIGE_CLIENT_SECRET, kept on your server
Redirect URIYour callback, registered exactly, such as <your-app-url>/auth/callback

Sign-up opens your organization’s Customer account, which the hub made when you added customer sign-in. You can rename it or give it claims later without changing anything on this page.

The two buttons

  1. Log in sends the authorization request from Sign people in and out as it is.

  2. Sign up sends the same request with prompt=create. Keep what the person typed on your sign-up form, such as their email, with the state, nonce and PKCE verifier. Your form’s contents stay with you.

    func (a *Auth) SignUp(w http.ResponseWriter, r *http.Request) {
        txn := a.newTxn(r)              // state, nonce, PKCE verifier
        txn.SignUp = true
        txn.PendingSignUp = PendingSignUp{Email: r.FormValue("email")}
        a.saveTxnCookie(w, txn)
        url := a.oauth2.AuthCodeURL(txn.State,
            oidc.Nonce(txn.Nonce),
            oauth2.S256ChallengeOption(txn.Verifier),
            oauth2.SetAuthURLParam("prompt", "create"))
        http.Redirect(w, r, url, http.StatusFound)
    }
  3. The callback is the one in Sign people in and out. After it verifies the ID token, it looks the customer up by sub. A new sub on a sign-up is a new customer, so create their record from your form under that sub. If the email on the form belongs to a customer you hold under another sub, see Customers who come back with another identity.

What the person sees, and what you get back

The personOn Trustaige’s pageYour callback receives
Is new to TrustaigeCreates a passkey on a page that names your organizationA code, then an ID token with a new sub
Has a Trustaige passkey but no account with youUses it through Already have a Trustaige passkey? Use it instead, or through Continue with your passkey when you send passkey_hint=existingA new sub
Already has an account with youConfirms with their passkey and is signed in to that accountTheir existing sub
Has an account you suspended or revokedSees no new account; signing up again leaves your decision in placeerror=access_denied&reason=account_inactive
Goes back to your appNothing is createderror=access_denied&reason=cancelled

Whether you already store the sub tells you if the person is new, so your app needs no flag for it.

If your form asks for details first

Many apps ask for a name and an email before the passkey. Put the passkey last, and protect the step that sends email:

  1. Check. Run HumanProof as its own step, before the form appears. Your app sends no email until the check passes, which stops anyone using the form to flood an inbox.

  2. Your details. Ask for a name and an email, send a 6-digit code to the email, and have the person enter it on the same page. Give the same answer for every address, so the form doesn’t reveal who is a customer. The code confirms the address and doesn’t sign anyone in.

  3. Your passkey. Label the button for what it does (Continue to your passkey), and send the request with prompt=create.

Lead with the passkey they already have

HumanProof proves a person with a passkey, so after the check the person holds a Trustaige passkey, even if they had none before. Add passkey_hint=existing to the sign-up request and Trustaige’s page opens with Continue with your passkey. If the person makes a new passkey instead, they get a second Trustaige identity, which reaches you as a second sub.

url := a.oauth2.AuthCodeURL(txn.State,
    oidc.Nonce(txn.Nonce),
    oauth2.S256ChallengeOption(txn.Verifier),
    oauth2.SetAuthURLParam("prompt", "create"),
    oauth2.SetAuthURLParam("passkey_hint", "existing"))

The page also offers Create a new one instead, for someone using another person’s device. Trustaige reads passkey_hint only with prompt=create.

url := a.oauth2.AuthCodeURL(txn.State,
    oidc.Nonce(txn.Nonce),
    oauth2.S256ChallengeOption(txn.Verifier),
    oauth2.SetAuthURLParam("prompt", "create"),
    oauth2.SetAuthURLParam("passkey_hint", "existing"))

Customers who come back with another identity

A person can hold two Trustaige identities without realising it. They might make one on a phone to claim an event pass, and later make another on a laptop. Each identity reaches you as a different sub, so a returning customer can sign up with an email you hold under their old sub.

If you refuse the email, they’re stuck: their new passkey has no account with you, and their address is taken. If you hand over the account to anyone who types the address, anyone could take it. Move the account once the person proves the address is theirs:

  1. Confirm the email before the passkey step, with the code from Your details, in the browser that is signing up. The right code shows the person at the screen reads that inbox. Give the same answer whether or not the address is on file.

  2. When Trustaige returns the new sub, look up the confirmed email. If it belongs to a customer under another sub, move that record to the new sub, with their orders and history. Sign them in, and tell them their account now opens with this passkey.

  3. Erase the old sub at Trustaige, as in Closing an account, so the identity they stopped using no longer signs in to your app.

If they don’t recognise the account, they can sign up with a different email and get a new account under the new sub.

Browsers that can’t use passkeys

Some in-app browsers, such as those inside social and messaging apps, can’t create or use passkeys. Trustaige’s page tells the person and gives them your app’s address to open in their own browser, with Cancel to return to you. A sign-up belongs to the browser that started it, so the person starts again on your site.

Your app needs no changes for this, but fill in both addresses on the app’s page in the hub:

  • Where do people land after signing out? A sign-up starts again here, so your home page works well.
  • Where does sign-in start at your app? A sign-in starts again here.

If both are empty, Trustaige uses the origin of your redirect URI.

When sign-up is refused

Refusals carry a reason, as they do for sign-in. One reason is specific to sign-up:

reasonMeans
sign_up_unavailableYour app’s setup in the hub doesn’t name an account to open, so nothing was created. This happens when an app admits several accounts and none is set for sign-up. Set it on the app’s page in the hub.

The full list is in When sign-in is refused.

Closing an account

When a customer closes their account with you, erase them from Trustaige using the sub you stored for them. A 404 means they’re already gone.

# 1. A token for your app
curl -u "$TRUSTAIGE_CLIENT_ID:$TRUSTAIGE_CLIENT_SECRET" \
  -d grant_type=client_credentials -d scope=issued:manage \
  https://id.trustaige.com/oauth2/token

# 2. Erase the customer
curl -X DELETE -H "Authorization: Bearer $TOKEN" \
  "$TRUSTAIGE_ISSUER/api/credentials/subjects/$SUB"

After sign-up covers what erasing removes and what stays.

# 1. A token for your app
curl -u "$TRUSTAIGE_CLIENT_ID:$TRUSTAIGE_CLIENT_SECRET" \
  -d grant_type=client_credentials -d scope=issued:manage \
  https://id.trustaige.com/oauth2/token

# 2. Erase the customer
curl -X DELETE -H "Authorization: Bearer $TOKEN" \
  "$TRUSTAIGE_ISSUER/api/credentials/subjects/$SUB"

Sign-up by button, or by offer

UseWhen
The Sign up button (this page)Anyone may open an account, as in a store or a service with self sign-up
An offer and a claim link (Offer an account by link)You choose who gets an account, such as existing customers you are moving over, people you checked first, or accounts with claims you set from the start

Both give the same kind of account and sub, and the person signs in the same way afterwards.

Next: protect risky actions with Countersign.