- iFrame Embedding
- Native React Component Embedding 🔒
- iFrame Embedding
- Native React Component Embedding 🔒
Please click on the Deploy button in the Hub.
You will need to get the JWT for the current user and the dashboard ID to render the correct dashboard. The JWT is generated by following the steps in Backend Setup. The dashboard ID could be found in the URL when you are viewing the dashboard you want to embed.Below is an example of deploying component with JWT using Clerk middleware:Common scenarios that trigger iframe reload:

Important: Changing the JWT token in the iframe
src will cause the browser to reload the entire iframe. This happens automatically when:- The JWT expires and gets refreshed
- User switches tenants/organizations
- Tenant permissions are updated
Understanding JWT Changes and Iframe Refresh
When theupsolveToken value changes in the code above, React will re-render the component with a new src URL for the iframe. This causes the browser to completely reload the iframe content.- Automatic token refresh (every hour)
- User switches between tenants/organizations
- User logs out and back in
- Tenant permissions are updated
To improve user experience during token updates: 1. Cache the previous token
until just before expiration 2. Show a loading overlay during refresh 3.
Coordinate token updates during natural breaks in user workflow
Database Row-Level Security (RLS) Setup 🔒
Database Row-Level Security (RLS) Setup 🔒
For databases with Row-Level Security policies (Postgres, Redshift, or Supabase), you need to include a database auth token (Learn more about setting up RLS for Postgres and Redshift in the Database Row-Level Security guide.Refer to the Supabase API docs for more details on managing sessions and tokens.
dbAuthToken) in the iFrame src URL. This token identifies the current user and is used by your database’s RLS policies to filter data at the row level.Example updated iFrame URL:- dbAuthToken: The user-specific identifier that your RLS policies use for row-level filtering
For Postgres and Redshift
ThedbAuthToken should contain the value that matches your RLS session variable (e.g., tenant ID, user ID, or company code):For Supabase
To retrieve the Supabase session token (dbAuthToken), you can use Supabase’s auth.getSession method:Deploying AI Chat
There are two ways to deploy AI chat in your front end:- iFrame Embedding
- Native React Component Embedding 🔒
- iFrame Embedding
- Native React Component Embedding 🔒
You’ll need to get the JWT for the current user and the agent ID to render the chat interface. The JWT is generated by following the steps in Backend Setup.
Below is an example of deploying chat with JWT using Clerk middleware:
Common scenarios that trigger session reset:
Getting the Agent ID
You can find your agent ID by visiting your agents at https://ai-hub.upsolve.ai/agents. The agent ID is visible in the URL when you click on an agent, or in the agent list view.
Authentication via JWT: Chat iframes use JWT tokens passed via query
parameters for authentication, similar to dashboards. Users don’t need to be
logged into the Hub - they just need a valid JWT token in the URL.
Important: Changing the JWT token in the iframe
src will cause the browser to reload the entire iframe and reset the chat session. This happens automatically when:- The JWT expires and gets refreshed
- User switches tenants/organizations
- Tenant permissions are updated
Query Parameters
The chat iframe supports the following query parameters:| Parameter | Type | Required | Description |
|---|---|---|---|
jwt | string | Yes | Tenant JWT for authentication |
prompt | string | No | Initial prompt to start the conversation |
theme | light | dark | No | Visual theme |
isAdmin | boolean | No | Enable admin features (default: false) |
hideHeader | boolean | No | Hide the header UI |
themeConfigs | JSON string | No | Custom theme configuration |
Example with Initial Prompt
Admin Mode
By default, the chat interface runs in end-user mode with simplified views. SetisAdmin=true to enable detailed tool execution information:Understanding Session Reset on JWT Change
When theupsolveToken value changes, React re-renders the iframe with a new src URL. This causes the browser to completely reload the iframe and start a new chat session.- Automatic token refresh (every hour)
- User switches between tenants/organizations
- User logs out and back in
- Tenant permissions are updated
To preserve chat history across token refreshes, consider: 1. Implementing
session persistence on your backend 2. Storing conversation history outside
the iframe 3. Refreshing tokens during natural conversation breaks 4. Warning
users before token expiration
