{"id":29091096,"url":"https://github.com/tooljet/tooljet-embed-app","last_synced_at":"2026-02-01T21:03:39.094Z","repository":{"id":301526280,"uuid":"1009503152","full_name":"ToolJet/tooljet-embed-app","owner":"ToolJet","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-27T09:34:22.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-27T10:34:16.803Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ToolJet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-27T08:35:22.000Z","updated_at":"2025-06-27T09:34:24.000Z","dependencies_parsed_at":"2025-06-27T10:34:18.396Z","dependency_job_id":"2a622ca4-2ca7-4842-9bab-645e749cf162","html_url":"https://github.com/ToolJet/tooljet-embed-app","commit_stats":null,"previous_names":["tooljet/tooljet-embed-app"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ToolJet/tooljet-embed-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToolJet%2Ftooljet-embed-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToolJet%2Ftooljet-embed-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToolJet%2Ftooljet-embed-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToolJet%2Ftooljet-embed-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ToolJet","download_url":"https://codeload.github.com/ToolJet/tooljet-embed-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToolJet%2Ftooljet-embed-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28990721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T20:57:35.821Z","status":"ssl_error","status_checked_at":"2026-02-01T20:57:29.580Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-28T06:05:05.399Z","updated_at":"2026-02-01T21:03:39.082Z","avatar_url":"https://github.com/ToolJet.png","language":"HTML","readme":"# ToolJet Embed App Setup\n\nA complete solution for embedding ToolJet applications with Express.js backend and responsive HTML frontend.\n\n## 📋 Prerequisites\n\n- Node.js (v14 or higher)\n- npm or yarn\n- A ToolJet instance with embed API access\n\n## 🛠️ Installation\n\n1. **Clone or create the project structure:**\n   ```\n   tooljet-embed-app/\n   ├── server.js\n   ├── package.json\n   ├── .env\n   └── public/\n       └── index.html\n   ```\n\n2. **Install dependencies:**\n   ```bash\n   npm install\n   ```\n\n3. **Configure environment variables:**\n   \n   Edit the `.env` file with your actual values:\n   ```env\n   PORT=3000\n   TOOLJET_EMBED_APP_URL=https://your-tooljet-instance.com/api/embed-app\n   TOOLJET_AUTH_TOKEN=your-base64-encoded-auth-token\n   ```\n   \n   Note: Email and App ID are now entered via the frontend form.\n\n## 🏃‍♂️ Running the Application\n\n### Development Mode\n```bash\nnpm run dev\n```\n\n### Production Mode\n```bash\nnpm start\n```\n\nThe application will be available at `http://localhost:3000`\n\n## 🔧 Configuration\n\n### Environment Variables\n\n| Variable | Description | Example |\n|----------|-------------|---------|\n| `PORT` | Server port | `3000` |\n| `TOOLJET_EMBED_APP_URL` | ToolJet embed API endpoint | `http://localhost:8082/api/embed-app` |\n| `TOOLJET_AUTH_TOKEN` | Base64 encoded auth token for Basic auth | `dG9vbGpldDp0b29samV0` |\n\n**Frontend Form Fields:**\n| Field | Description | Required | Example |\n|-------|-------------|----------|---------|\n| Email | User email for authentication | Yes | `admin@tooljet.com` |\n| App ID | ToolJet application ID | Yes | `2e9be257-31ba-46bb-8451-fcb601227aa7` |\n| Session Expiry | Session expiry time in milliseconds | No | `10000` |\n| PAT Expiry | Personal Access Token expiry in milliseconds | No | `10000` |\n\n## 🎯 How It Works\n\n1. **Initial Load**: User accesses the root URL and sees the configuration form\n2. **Configure**: User fills in email, app ID, and optional expiry settings\n3. **Load App**: User clicks \"Load App\" button (enabled only when required fields are filled)\n4. **API Call**: Frontend makes POST request to `/api/embed-app-url` with form data\n5. **ToolJet API**: Backend calls ToolJet embed API with user credentials\n6. **Iframe Load**: Frontend loads the returned `redirectUrl` in an iframe\n7. **Message Handling**: Listens for messages from the embedded app\n8. **Error Handling**: Shows re-authentication dialog on errors\n\n## 📡 API Endpoints\n\n### POST /api/embed-app-url\n\nCalls the ToolJet embed API with user-provided credentials and optional expiry settings.\n\n**Request Body:**\n```json\n{\n  \"email\": \"user@example.com\",\n  \"appId\": \"2e9be257-31ba-46bb-8451-fcb601227aa7\",\n  \"sessionExpiry\": 10000,  // Optional\n  \"patExpiry\": 10000       // Optional\n}\n```\n\n**Response (Success):**\n```json\n{\n  \"success\": true,\n  \"redirectUrl\": \"http://localhost:8082/embed-apps/app-id?personal-access-token=token\"\n}\n```\n\n**Response (Error):**\n```json\n{\n  \"success\": false,\n  \"error\": 400,\n  \"message\": \"Email and App ID are required\"\n}\n```\n\n## 🔄 Message Handling\n\nThe frontend listens for messages from the embedded ToolJet application:\n\n```javascript\n// Example message from ToolJet\n{\n  type: 'TJ_EMBED_APP_LOGOUT',\n  error: 400,\n  message: 'Missing token or appId'\n}\n```\n\nWhen a logout message is received:\n1. The iframe is hidden\n2. An error dialog appears\n3. User can choose to re-authenticate\n\n\n## 🛡️ Error Handling\n\nThe application handles various error scenarios:\n\n- **Network Errors**: API connection failures\n- **Authentication Errors**: Invalid credentials or expired tokens\n- **ToolJet App Errors**: Messages from the embedded application\n- **Server Errors**: Backend processing issues\n\n## 🔍 Troubleshooting\n\n### Common Issues\n\n1. **\"Failed to load application\"**\n   - Check if ToolJet instance is running\n   - Verify `TOOLJET_EMBED_APP_URL` is correct\n   - Ensure network connectivity\n\n2. **\"Missing token or appId\"**\n   - Verify `USER_EMAIL` and `TOOLJET_APP_ID` in `.env`\n   - Check if `TOOLJET_AUTH_TOKEN` is correctly base64 encoded\n   - Ensure the user has access to the app\n\n3. **\"Authentication Failed\"**\n   - Verify `TOOLJET_AUTH_TOKEN` is valid and not expired\n   - Check if the token has proper permissions for embed API\n\n4. **CORS Issues**\n   - Ensure ToolJet instance allows your domain\n   - Check ToolJet CORS configuration\n\n### Debug Mode\n\nEnable detailed logging by checking the browser console and server logs:\n\n```bash\n# Server logs\nnpm run dev\n\n# Browser console\nF12 → Console tab\n```\n\n## 📁 Project Structure\n\n```\ntooljet-embed-app/\n├── server.js              # Express.js server\n├── package.json           # Dependencies and scripts\n├── .env                   # Environment variables\n├── README.md             # This file\n└── public/\n    └── index.html        # Frontend application\n```\n\n5. Submit a pull request\n\n## 📞 Support\n\nFor issues related to:\n- **ToolJet**: Refer to [ToolJet documentation](https://docs.tooljet.com/)\n- **Express.js**: Check [Express.js documentation](https://expressjs.com/)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftooljet%2Ftooljet-embed-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftooljet%2Ftooljet-embed-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftooljet%2Ftooljet-embed-app/lists"}