---
title: Build an app for saved results
published: true
access: public
index: 0
---

# Build an app for saved results

A customer's agent can save a finished report to your Glue project. Your website can show that report when the same customer signs in, even on another device. The customer approves their device to save reports and separately approves your app to read them. With read consent, your app's servers can list and retrieve any result that customer saved to your app.

You build, deploy and update the viewer in your own repository. Glue's app settings identify the website allowed to request data and let you pause its access. For example, Store Skills saves the audit, Glue stores it privately, and the hosted Store Skills viewer displays it. If a merchant changes an issue status there, the viewer writes the change to Glue so the same merchant can see it on another device.

## Register your website

You need a Glue project with MCP enabled, a server with an HTTPS address you control, and access to DNS for that hostname.

1. As a project owner or admin, open **Settings → Channels → Apps → Register app**. Enter the customer-facing app name and the name of its operator. Both appear during approval.
2. Choose a handle such as `audit-viewer`. Set the origin to your site's exact origin, such as `https://app.example.com`. Set the redirect address to a route on that origin, such as `https://app.example.com/auth/callback`.
3. Store the client ID and the one-time client secret on your server. Open the app's **Settings** and copy its **App ID**. The handle identifies the app to an agent, the client ID identifies it during sign-in, and the app ID goes in API paths.
4. Add the displayed TXT record at `_glue-app.<your hostname>`. Once it resolves, choose **Enable**. A change to the origin requires a new proof.

## Save a test report

Use a Glue CLI release that supports `login --save`. On the customer's device, replace `PROJECT_SLUG` and `APP_HANDLE` and run:

```sh
npx glue-fast login --site https://glue.fast --save PROJECT_SLUG/APP_HANDLE
```

During agent setup, explain which reports and attachments the skill will upload. The customer approves saving to the named app in the browser once for this terminal login. A login created before saving was requested needs fresh approval. Store Skills uses this permission to save each completed audit and its disclosed attachments automatically, including before the merchant first signs in to the viewer.

Restart the CLI-backed MCP connection so it picks up the approved login. For a [direct HTTP connection](../tools/connect-to-mcp.md), replace the bearer token in the agent’s secret settings with the newly approved customer token before reconnecting. Confirm the project now offers `save_result`.

To test with synthetic data, create this file. The final newline is part of its digest.

```sh
printf '%s\n' '{"summary":"Your test result"}' > report.json
```

Use this manifest for those exact bytes:

```json
{
  "version": "glue-app-result/v1",
  "kind": "test-report",
  "title": "First saved report",
  "createdAt": "2026-11-25T12:00:00Z",
  "artifacts": [{
    "id": "report",
    "role": "report",
    "mediaType": "application/json",
    "bytes": 31,
    "sha256": "ddf3b78d25ff5a399a8078788f30e98acadf01bf34d9133ccf80f4baa4b65893"
  }]
}
```

1. Generate one UUID and keep it as `saveId` beside the local report. Call `save_result` with `step: "begin"`, `app: APP_HANDLE`, that `saveId` and `manifest: JSON.stringify(manifest)`. The tool takes a string for the manifest.
2. For a `staging` response, send the matching file's raw bytes in a `PUT` to each returned upload URL. Set `Authorization: Bearer <transferToken>` and the manifest's `Content-Type`. Send the token only to the expected HTTPS Glue origin and refuse redirects. Each successful upload returns `204`.
3. Call `save_result` with `step: "finalize"`, the same `app` and the same `saveId`. Keep the `receipt.resultId` from the `committed` response. The result is now visible to the customer.

If the connection drops, repeat **begin** with the same ID and manifest. Use the fresh token and upload only the missing files. If the result already committed, **begin** returns its receipt. A different manifest under the same ID returns `conflict`. Unfinished transfers expire after 30 minutes.

Each result needs one JSON `report`. It can also hold a JSON `viewer-context`, JSON `viewer-state`, Markdown, and PNG, JPEG, WebP, GIF or AVIF evidence. Give each file an opaque ID and refer to it inside the report as `attachment:<id>`. The limits are 4 MiB per file, 25 MiB and 64 files per result, and 24,000 characters for the serialized manifest.

## Sign the customer in

1. On your server, generate a random, single-use `state` and a PKCE `code_verifier` for this sign-in attempt. Store both in the customer's short-lived server session. Derive `code_challenge` as the unpadded base64url encoding of the SHA-256 digest of the verifier.
2. Redirect the browser to `https://glue.fast/api/auth/oauth2/authorize`. URL-encode `response_type=code`, `client_id`, your exact registered `redirect_uri`, `state`, `code_challenge`, `code_challenge_method=S256` and the space-separated `scope`. Start a read-only viewer with `results:read`. Add `state:write` for editing statuses or `results:delete` for a customer-initiated delete.
3. If the customer selected **Continue with Google** in your app, as they do in Store Skills, include `idp_hint=google`. A signed-out customer goes directly to Google. Apps that omit the hint use Glue’s sign-in button. Glue can reuse an active sign-in session.
4. On first use, Glue asks the customer to allow this app and explains that the named operator’s servers can receive their saved results. Glue remembers the approved permissions for that customer’s account and your client ID across devices. It asks again if you request an additional scope or the customer has removed access. In your callback, verify the returned `state` against the session and consume it once. If the customer declines, end the attempt.
5. From your server, `POST` an `application/x-www-form-urlencoded` body to `https://glue.fast/api/auth/oauth2/token` with `grant_type=authorization_code`, `code`, `redirect_uri`, `client_id`, `client_secret` and `code_verifier`. Use the same redirect address as in step 2.
6. Associate the returned `access_token` with your own secure HttpOnly session. Use `expires_in` to expire it. The pilot issues one-hour access tokens. To renew, start another authorization request.

## Open the saved report

From the app's server, send `Authorization: Bearer <access_token>` on each request below. Prefix each path with `https://glue.fast/api/v1/apps/<APP_ID>`. Serve responses privately to the signed-in customer and disable shared caching.

1. [List the customer's results](../../references/developer/results/list.md) and find the ID from the save receipt.
2. [Get the result](../../references/developer/results/get.md) and find the artifact whose role is `report`.
3. [Download the artifact](../../references/developer/artifacts/download.md) and display its contents. In the test report above, the artifact ID is `report`.

If the viewer lets customers mark an issue as done, [read its state](../../references/developer/viewer-state/get.md), then [update the issue](../../references/developer/viewer-state/update.md) with the customer's `state:write` permission. See the [registered app requests](../../references/developer/README.md#registered-apps) for the full list.

To support the status example, include a `viewer-state` artifact at save time with the JSON `{"version":"glue-viewer-state/v1","keys":["issue-1"],"values":["open","done"],"initial":{"issue-1":"open"}}`. Glue accepts changes only for the declared keys and values.

Verify your first integration by signing in as the customer who saved the file. The list should include **First saved report**, its ID should match the receipt, and its report artifact should contain the original 31 bytes. A second customer should see their own list. Removing consent in **Devices → Connected apps** should stop the app's next private request.

Expired or ended tokens return `401`. Missing consent or scope returns `403`. Check the response's `error.code`: `app_paused` means the operator disabled the app. An unavailable result returns `404`. For `429`, wait for `Retry-After` before trying again.

## Operate the app

App settings show aggregate saves, customers, stored bytes, opens and bytes served. Customer report contents reach the operator through the consented app API. The default quotas are 100 saved results per customer and 5 GiB per app. The pilot adds no charges for saving, retrying or opening results.

Choose **Rotate secret** to replace the secret and immediately update your server. **Disable** pauses access while retaining saved data. A customer can revoke a device to stop uploads or revoke an app to stop reads. Deleting their Glue account removes their results. An app or project must be empty of saved results before it can be deleted.
