View as Markdown

Embeds · Guide

Open a hosted result page

The admin embeds (capture result, checkout result, run result, traffic result, the request composer, your rules) need a web admin you control. When you don't have one, or your staff are on a phone, mint a link instead: it opens a page Provenance hosts, branded with your account's Branding, that shows the same element. There's nothing to drop into a page and no publishable key.

Before you begin: a secret key with the element's scope (attest for a capture result or the composer, authorize for a checkout result). Hosted pages need Pro or the Free trial, as the elements do.

export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_capture_C4pT9vQ2bW7mK3sYd8cFjLh6gAe1nR5x

POST /v1/embed/links takes the same body as POST /v1/embed/tokens and runs the same checks. It returns the page's url:

In the SDK tabs, prov (Node, Python) and embed (Go) are your server-side clients, set up as in admin results and requests.

curl -s -X POST $PROVENANCE_API/v1/embed/links \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "widget": "capture_result", "object_id": "capr_01M7JDNVW9Y267T8JEKZHVYP7G", "show": ["case_id"] }'
FieldWhat it does
widgetcapture_result, checkout_result, run_result, traffic_result, capture_request or rules. Another widget is 400 parameter_invalid.
object_id, show, author, request, mode, rulesAs for the element's token. A composer's max_sends counts every send the page makes. A rules page takes the kind, the mode and the full scope (rules in your admin).
ttlSeconds the link can be opened in, up to 900 (15 minutes, the default).
session_ttlSeconds the opened page works for, 60 to 3600 (60 minutes, the default).

The url is on the console's address, with the link in the query: /r?t=embl_…. Hand it to the person who needs it: open it, send it in an email or a text, or open it in your app. For a text, use short_url when the answer has one: the same page as a short link.

2. What the page does

  • It opens once. The first opening starts a page session; the link then stops working (409 embed_link_used), and one not opened within ttl never does (400 embed_link_expired). Mint a new link each time.
  • It keeps its session for up to an hour in the browser that opened it, renewing the element's 15-minute session on its own. A reload in the same tab keeps it.
  • It takes the link out of the address bar as it opens, so the link isn't left in the tab's history or shared from it.
  • It shows the element as your admin would: the same rows, one line each, the same trust chrome, your Branding, light or dark. There's no slot for your own next step; act from your own tools.

3. Open it from a React Native app

Phones open the hosted page in the in-app browser first; native components come later. Your server mints the link (its secret key never ships in the app) and the app opens it:

This package isn't on npm yet. Until then, every request in these docs runs over HTTP against the sandbox.

With access to the private Provenance repository, which your Provenance contact grants, install from it:

git clone https://github.com/michaelnbane-jpg/provenance.git provenance
cd provenance && pnpm install && pnpm build
node scripts/check-publishable.mjs --out ../provenance-packs
cd ../your-project
npm install ../provenance-packs/provenanceauth-sdk-1.0.0.tgz ../provenance-packs/provenanceauth-react-native-1.0.0.tgz
import { openHostedPage } from "@provenanceauth/react-native";

const { url } = await (await fetch(`${yourServer}/admin/provenance/link?request=${requestId}`)).json();
await openHostedPage(url);

openHostedPage opens the page in SFSafariViewController or a Custom Tab, and refuses anything that isn't a hosted page link.

Embed, hosted page, console or your own

EmbedHosted pageThe consoleYour own UI on the API
WhereYour web adminA phone, an email to a manager, a reviewer without an admin seatEvery account's own pagesAnywhere
PlanPro and upPro and upEvery planEach API's own plan
You doMint a session, drop a tagMint a linkNothingMap the fields, check the signature, track deliveries

Errors you might see

ErrorWhyWhat to do
409 embed_link_usedThe link was opened alreadyMint a new link. The page it opened keeps working in that browser.
400 embed_link_expiredThe link wasn't opened within ttlMint a new link.
401 embed_token_invalidNot a link, or the page session has endedMint a new link.
403 insufficient_scopeThe key lacks the element's scopeUse a key with attest (capture) or authorize (checkout).

See also