Setting up an embedded app
To enable embedding, configure these settings when creating or editing your app:- Enable Embedded Mode
- Set your App URL — the page that will be loaded inside the iframe (e.g.,
https://yourapp.example.com/embed)
Session token flow
When a merchant opens your embedded app, the following happens:Merchant clicks your app
From their Installed Apps list, the merchant clicks the Open button on your app.
OrderProtection generates a session token
The dashboard calls the OrderProtection API to generate a short-lived JWT session token containing the current user’s context.
Your app loads in an iframe
Your App URL is loaded in an iframe with the session token appended as a query parameter:
Your app extracts the token
Your frontend JavaScript extracts the
session_token parameter from the URL:Your server verifies the token
Send the session token to the OrderProtection verification endpoint from your server:
Verification response fields
| Field | Description |
|---|---|
userId | The OrderProtection user ID of the merchant viewing your app |
email | The merchant’s email address |
firstName | The merchant’s first name |
lastName | The merchant’s last name |
storeId | The ID of the store the merchant is currently viewing |
installationId | The ID of this app’s installation on this store |
applicationId | Your app’s ID |
clientId | Your app’s client ID |
scopes | Array of scopes the merchant granted to your app |
Security
Token lifetime
Session tokens are valid for 60 seconds. They are designed for a single use — extract the token, verify it immediately, and establish your own session. Do not store or reuse session tokens.Iframe sandboxing
The iframe that loads your app is sandboxed with the following permissions:allow-top-navigation is not granted).
Rate limiting
The session verification endpoint is rate-limited to 30 requests per minute per IP address.Best practices
- Verify server-side — Always verify session tokens from your backend, never from client-side JavaScript alone. The verification endpoint validates the token signature and checks that the installation is still active.
- Handle expiration — If verification returns an error, the token may have expired. Display a message asking the merchant to reload the app.
- Responsive design — Your embedded page should be responsive, as the iframe adapts to the available dashboard space.
- No popups for auth — Since the merchant is already authenticated via the session token, avoid redirecting to login pages or showing auth prompts.

