# Customer credentials

> Sign your customers up and in without passwords. A Sign up button opens their account with a passkey, and each sign-in is standard OpenID Connect.

Source: https://docs.trustaige.com/customer-credentials

Replace these placeholders with your organization's own values:

- `<your-org-id>`: Organization short ID, for example `a1B2c3D4e5F6`. The part after /o/ in your hub’s address.

Your customers get an account with a passkey, so you build no passwords and no
reset flow. Trustaige handles sign-up, sign-in, recovery and revocation, and
your customers' names and addresses stay in your database.

[AIGE Labs](https://aigelabs.com) is a working store built on this guide. Sign
up there to see each step.

## What you're building

Your app gets two buttons. Log in sends a standard OpenID Connect sign-in
request to your organization's issuer. Sign up sends the same request with
`prompt=create`. Trustaige asks the person for a passkey, creating one if they
have none, opens their account with you, and returns them to your app with a
`sub`, which is your identifier for that customer. You save your own record
under that `sub`, and each later sign-in returns the same `sub`.

You keep whatever your sign-up form collects, and you send your customers
your own emails. If you want to choose who gets an account, you can instead
[offer an account by link](/customer-credentials/sign-up): you ask Trustaige
for a subject and a claim link, and email the link yourself.

If your app keeps other ways in beside Trustaige,
[offer Trustaige beside them](/customer-credentials/beside-other-methods):
countersign what matters, guard the first link, and let customers sign in only
with Trustaige.

## What it stops

To take over an account through its sign-in, an attacker needs four things: a
target, a secret to steal, a way to use it on the real site, and a way past the
second factor. Sign-in with passwords, codes or push approvals gives them all
four. Sign-in with a passkey gives them none, once the account has no weaker
way in beside it.

| Attack step | With a password, code or push | With a passkey |
|---|---|---|
| Find a target | The sign-in page confirms which emails have accounts, so attackers can build a list. | The person types no username or email. The passkey identifies them, so the page doesn't reveal who is a customer. |
| Steal the secret | Passwords leaked from other sites, phished, or guessed across many accounts open accounts here. | There is no password. Trustaige keeps only public keys, and your database holds no credentials. |
| Use it on the real site | A look-alike site passes the password and one-time code to the real one as they're typed. | A passkey works only on the site it was made for, and has no password or code behind it. |
| Get past the second factor | Push prompts repeat until someone taps Approve to stop them. | The person unlocks their own device with their face, fingerprint or PIN, in a step they started. Nothing is pushed to them. |

> **Recovery:** A person who loses their passkey can recover with a recovery code they saved,
> or with an email link that works only after 72 hours. During those 72 hours,
> any of their devices can cancel it, and the person is told either way. Your
> app takes no part in recovery.

The whole trust model, written for whoever reviews Trustaige before your app
relies on it, is in
[How Trustaige keeps a sign-in safe](/customer-credentials/trust-model).

## The whole integration

These are the calls a store makes to Trustaige for the Sign up button. Two of
them are code you write. Your OpenID Connect library makes the others.

| # | Step | Call | Who does it |
|---|---|---|---|
| 1 | Discover your issuer | `GET /o/<your-org-id>/.well-known/openid-configuration` | your OIDC library |
| 2 | Send the person to sign up (`prompt=create`) or sign in | `GET /oauth2/authorize` | your OIDC library |
| 3 | Exchange the code for an ID token | `POST /oauth2/token` | your OIDC library |
| 4 | Fetch your signing keys | `GET /o/<your-org-id>/jwks.json` | your OIDC library |
| 5 | Send the person to sign out | `GET /oauth2/logout` | your OIDC library |
| 6 | Get a client token | `POST /oauth2/token` | **your code** |
| 7 | Erase a customer who leaves | `DELETE /o/<your-org-id>/api/credentials/subjects/{subject}` | **your code** |

If your sign-up form sends email before the passkey step, add HumanProof to
it: a script tag loads `GET /humanproof.js`, and your server checks the token
with `POST /humanproof/verify`. Offering accounts by link adds HumanProof and
`POST /o/<your-org-id>/api/credentials/offers`.

All calls go to the hub, `https://id.trustaige.com`. Your organization's issuer
is `https://id.trustaige.com/o/<your-org-id>`, shown under **CIAM → Overview**
in the hub. Your organization signs its own tokens with its own keys.

## How it fits together

Signing up:

1. Person → Your app: fills in your form, clicks Sign up
2. Your app → Trustaige: redirect: /oauth2/authorize, prompt=create
3. Person ↔ Trustaige: creates or uses a passkey
4. Trustaige → Your app: code → ID token (new sub)
5. Your app → Person: saves the record, signed in

Signing in afterwards:

1. Person → Your app: clicks Log in
2. Your app → Trustaige: redirect: /oauth2/authorize
3. Person ↔ Trustaige: passkey
4. Trustaige → Your app: code → ID token (sub)
5. Your app → Person: signed in

## Who keeps what

| You keep | Trustaige keeps |
|---|---|
| Your customer's name, email and what your forms collect | The person's identity and passkeys, which belong to them |
| Their orders, preferences and history | That your organization gave them an account, with its status and dates |
| The `sub`, as the key to all of it | Any claim values you set, signed into the credential |
| The emails you send them | |

You don't see the person's recovery contacts, their other organizations, or
credentials others gave them. They don't see your records.

## The guide

1. [**Set up in the hub**](/customer-credentials/setup): prove your domain,
   design a credential, connect your app.
2. [**Sign up with a button**](/customer-credentials/sign-up-button): your Sign
   up button adds `prompt=create`, and Trustaige opens the account.
3. [**Beside other sign-in methods**](/customer-credentials/beside-other-methods),
   when your app keeps them: countersign what matters, guard the first link,
   let customers sign in only with Trustaige.
4. [**Offer an account by link**](/customer-credentials/sign-up), when you choose
   who gets one: HumanProof, a client token, the offer, the claim link.
5. [**Sign people in and out**](/customer-credentials/sign-in): the OpenID
   Connect flow, the ID token, refusals.
6. [**Countersign risky actions**](/customer-credentials/countersign): transfers,
   new recipients and contact changes confirmed on the customer's own device.
7. [**After sign-up**](/customer-credentials/lifecycle): renewal, suspension,
   reading what you issued, helping a customer, and erasing one who leaves.
8. [**Before you go live**](/customer-credentials/go-live): the checklist.
