# Sandbox

The Truora Pass sandbox is a separate copy of Truora Pass for building and testing your integration. It runs the same sign-up, verification and authorization flows as production, but no real identity is checked, no message is sent, and nothing you do there is billed. Documented test values decide every verification outcome.

**Note**: Never put real data in the sandbox. Sandbox accounts are not private: anyone can sign in to the sandbox as any email address, so treat everything you enter there as public. Each email address is one sandbox account, shared by everyone who signs in with it, so use a new email address each time you test sign-up.

## Hosts

| | Production | Sandbox |
|---|---|---|
| Sign-in UI / SDK (IdP host) | `https://pass.truora.com` | `https://pass.sandbox.truora.com` |
| API base | `https://api.pass.truora.com` | `https://api.pass.sandbox.truora.com` |
| Dashboard | `https://dashboard.pass.truora.com` | `https://dashboard.pass.truora.com`, with the **Sandbox** toggle on |

The sandbox and production are separate: an application, its client id and its secrets exist in only one of them. The sandbox token endpoint refuses a production client id as invalid client credentials, and production refuses a sandbox client id the same way; see [Errors and troubleshooting](/truora-pass/errors_and_troubleshooting/) for the error each grant returns.

Sandbox tokens name the sandbox host as their issuer (`iss`), and the sandbox discovery document lists the sandbox endpoints and keys. If your application checks the issuer, configure it per environment.

## Get sandbox credentials

1. Sign in to the [Truora Pass Dashboard](https://dashboard.pass.truora.com) with your Truora account.
2. Turn on the **Sandbox** toggle at the top of the dashboard. A **Test data** badge shows next to it while it is on.
3. Create an application as you would in production. See [Registering your application](/truora-pass/registering_your_application/).

The client id and secret you get work only against the sandbox hosts. Turn the **Sandbox** toggle off to see your production applications.

## Point your integration at the sandbox

Use the sandbox hosts wherever your integration names a Truora Pass host:

- **Authorization Code flow**: send the user to `https://pass.sandbox.truora.com/authorize` and exchange the code at `https://api.pass.sandbox.truora.com/v1/oauth2/token`.
- **Embedded SDK**: load `client.js` from the sandbox host and pass `baseUrl` and `mode: "popup"`:

```html
<button id="sign-in">Sign in with Truora Pass</button>
<script src="https://pass.sandbox.truora.com/client.js"></script>
<script>
  let state;

  TruoraPass.init({
    appClientId: "WLT_APP_your_sandbox_client_id",
    baseUrl: "https://pass.sandbox.truora.com",
    mode: "popup",
    onAuthorized: function (result) {
      if (result.state !== state) return; // not the request this page started
      // send result.code to your backend to exchange it for tokens
    }
  });

  document.getElementById("sign-in").addEventListener("click", function () {
    state = crypto.randomUUID();
    TruoraPass.authorize({
      redirectUri: "https://app.example.com/callback",
      scope: "openid profile email",
      state: state
    });
  });
</script>
```

- **UserInfo**: call `https://api.pass.sandbox.truora.com/v1/oauth2/userinfo` with a sandbox access token.

**Note**: The SDK modal (iframe) does not open from your own origin in the sandbox yet, so the snippet passes `mode: "popup"`. The snippet checks `state` in the browser for brevity; in production, bind it to the user's session on your server as the [Embedded SDK](/truora-pass/embedded_sdk/#complete-example) note describes. The origin of your `redirectUri` must still be in **Authorized JavaScript origins**, as in production. You can also use the [Authorization Code flow](/truora-pass/authorization_code_flow/) redirect.

### If the browser blocks the popup

Call `TruoraPass.authorize` from a click handler, as the snippet does: browsers block a popup that no click opened. What you get back depends on whether the popup opens:

- **The popup opens**: the code arrives in `onAuthorized`.
- **The popup is blocked on your top-level page**: the SDK sends your page to the sandbox sign-in with a full-page redirect, and the code arrives as query parameters on your `redirectUri`, not in `onAuthorized`. That URI must exactly match a registered redirect URI. The page that held `state` is gone, so keep `state` in your session and read the code on that page as in the [Authorization Code flow](/truora-pass/authorization_code_flow/).
- **The popup is blocked inside an iframe**: the SDK calls `onError` with `popup_blocked`.

## Test values

### Document and face

When the sandbox asks for the document, type one of these document numbers. The number decides both the document and the face result, whatever photos you use:

| Document number | Document | Face | Result |
|---|---|---|---|
| `1000000001` | Verified | Verified | Sign-up completes and the authorization issues a code. |
| `1000000002` | Declined, `sandbox_document_expired` | Not reached | The user sees that the document is expired. |
| `1000000003` | Verified | Declined, face does not match | The user sees that the face does not match the document. |
| Any other number | Declined, `sandbox_document_not_found` | Not reached | The user sees that the document was not found. Never a success. |

Any number of testers can use the same test number at the same time. Sign up with a new email address for each test run: an account that already exists may not be asked for its document again.

### One-time codes

No email or text message is sent in the sandbox. Use the fixed code instead:

| Code | Email and phone result |
|---|---|
| `123456` | Verified |
| Any other code | Email: the verification fails at once; request a new code. Phone: the user can try again, and the third wrong code fails the verification. |

### Google, Microsoft and Apple sign-in

The sandbox does not contact Google, Microsoft or Apple. When the user picks one of them, a sandbox sign-in dialog opens instead:

| What you choose in the sandbox sign-in dialog | Result |
|---|---|
| Type an email address, for example `tester@example.com`, and choose **Sign in with this email** | Signs in as that email address with a verified email. |
| **Send an invalid token** | The sign-in is refused, as when the provider's token does not verify. |
| **Send an unverified email** | The sign-in is refused, as when the provider has not verified the email address. |

Passkeys work in the sandbox and are bound to the sandbox host, so a production passkey does not sign in there.

## Billing and events

Nothing done in the sandbox is billed or counts toward your usage. Sandbox activity does not trigger your webhooks or business rules: test the receiving side of your webhooks in production.

Every page of the sandbox shows a Sandbox banner, so testers know they are not in production.
