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
1. Mint a link on your server
POST / takes the same body as POST / 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"] }'
// GET /admin/provenance/link?request=capr_… (your route, behind your staff sign-in)
const link = await prov.embed.createLink({ widget: "capture_result", objectId: requestId, show: ["case_id"] });
res.json({ url: link.url });
url = prov.embed.create_link(widget="capture_result", object_id=request_id, show=["case_id"])["url"]
link, err := embed.CreateLink(ctx, pv.EmbedLinkParams{Widget: pv.WidgetCaptureResult, ObjectID: requestID, Show: []string{"case_id"}})
| Field | What it does |
|---|---|
widget | capture_, checkout_, run_, traffic_, capture_ or rules. Another widget is 400 parameter_. |
object_, show, author, request, mode, rules | As for the element's token. A composer's max_ counts every send the page makes. A rules page takes the kind, the mode and the full scope (rules in your admin). |
ttl | Seconds the link can be opened in, up to 900 (15 minutes, the default). |
session_ | Seconds 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 (
409embed_link_used), and one not opened withinttlnever does (400embed_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.tgzimport { 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
| Embed | Hosted page | The console | Your own UI on the API | |
|---|---|---|---|---|
| Where | Your web admin | A phone, an email to a manager, a reviewer without an admin seat | Every account's own pages | Anywhere |
| Plan | Pro and up | Pro and up | Every plan | Each API's own plan |
| You do | Mint a session, drop a tag | Mint a link | Nothing | Map the fields, check the signature, track deliveries |
Errors you might see
| Error | Why | What to do |
|---|---|---|
409 embed_ | The link was opened already | Mint a new link. The page it opened keeps working in that browser. |
400 embed_ | The link wasn't opened within ttl | Mint a new link. |
401 embed_ | Not a link, or the page session has ended | Mint a new link. |
403 insufficient_ | The key lacks the element's scope | Use a key with attest (capture) or authorize (checkout). |