{"id":30710772,"url":"https://github.com/ekoindia/redirect-hub","last_synced_at":"2026-02-12T02:09:35.856Z","repository":{"id":309504009,"uuid":"1036460428","full_name":"ekoindia/redirect-hub","owner":"ekoindia","description":"Shared redirect landing for Eko apps; forwards query/hash to opener and closes.","archived":false,"fork":false,"pushed_at":"2025-08-12T08:57:33.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-03T01:13:44.997Z","etag":null,"topics":["tool"],"latest_commit_sha":null,"homepage":"https://ekoindia.github.io/redirect-hub/examples/","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/ekoindia.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-08-12T05:39:45.000Z","updated_at":"2025-08-12T08:57:37.000Z","dependencies_parsed_at":"2025-08-12T09:40:09.747Z","dependency_job_id":null,"html_url":"https://github.com/ekoindia/redirect-hub","commit_stats":null,"previous_names":["ekoindia/redirect-hub"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ekoindia/redirect-hub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekoindia%2Fredirect-hub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekoindia%2Fredirect-hub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekoindia%2Fredirect-hub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekoindia%2Fredirect-hub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ekoindia","download_url":"https://codeload.github.com/ekoindia/redirect-hub/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekoindia%2Fredirect-hub/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29354709,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T01:03:07.613Z","status":"online","status_checked_at":"2026-02-12T02:00:06.911Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["tool"],"created_at":"2025-09-03T01:08:47.369Z","updated_at":"2026-02-12T02:09:35.851Z","avatar_url":"https://github.com/ekoindia.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Eko Redirect Hub — Cross-Origin Callback Relay\n\n**A shared, cross-origin redirect landing page for Eko’s web apps.**\nIt **captures all query/hash parameters**, **posts them to the opener** via `postMessage`, and **auto-closes**. When no opener is available, it **redirects back** to a provided URL with all parameters appended.\n\n\n[![GitHub issues](https://img.shields.io/github/issues/ekoindia/redirect-hub)](https://github.com/ekoindia/redirect-hub/issues)\n\u003ca href=\"https://eko.in\" target=\"_blank\"\u003e![Eko.in](https://img.shields.io/badge/Develop%20with-Eko.in-brightgreen)\u003c/a\u003e\n\u003ca href=\"https://twitter.com/intent/tweet?text=Wow:\u0026url=https%3A%2F%2Fgithub.com%2Fekoindia%2Fredirect-hub\" target=\"_blank\"\u003e\u003cimg alt=\"Twitter\" src=\"https://img.shields.io/twitter/url?style=social\u0026url=https%3A%2F%2Fgithub.com%2Fekoindia%2Fredirect-hub\"\u003e\u003c/a\u003e\n\u003ca href=\"https://twitter.com/intent/follow?screen_name=ekospeaks\" target=\"_blank\"\u003e![Twitter Follow](https://img.shields.io/twitter/follow/ekospeaks?label=Follow\u0026style=social)\u003c/a\u003e\n\n\n---\n\n## Why this exists\n\nEko's webapps open 3rd-party pages in new tabs, instead of redirecting to them by replacing the current page. But, many 3rd-party tools require a redirection-URL to redirect back to the calling page. This generic solution addresses these needs by providing:\n\n* **One redirection-target page for many apps** (different origins/subdomains).\n* **Works with OAuth/OIDC and generic tool callbacks.**\n* **No tight coupling** to any provider; forwards *everything* it receives.\n\n---\n\n## Features\n\n* **Generic param pass-through**: forwards *all* query + hash params as-is.\n* **Cross-origin safe**: uses `window.opener.postMessage` to pass the payload.\n* **Auto-close**: closes the callback tab if script-opened; shows a manual close hint otherwise.\n* **Graceful fallback**: if `opener` is missing, navigates to your app’s `return_to` with all params.\n\n---\n\n## Quick Start\n\n### 1) Deploy the redirector\n\nHost the static `index.html` at a neutral domain, e.g. **`https://redirect.eko.in/`**.\n\n### 2) Open the external tool / auth URL from your app\n\n* Add `return_to`, and `state` (with PKCE if OAuth), if required.\n* Open in a **script-initiated** popup/tab so the redirector can close itself.\n\n```js\n// In your app (e.g., https://app.eko.in)\nconst state = crypto.randomUUID(); // or a JWS from your backend\nsessionStorage.setItem('oauth_state', state);\n\nconst auth = new URL('https://tool.example.com/oauth/authorize');\nauth.searchParams.set('client_id', '...');\nauth.searchParams.set('redirect_uri', 'https://redirect.eko.in/');\nauth.searchParams.set('response_type', 'code');\nauth.searchParams.set('state', state);\n\n// Prefer embedding these inside `state` if the provider strips them\nauth.searchParams.set('return_to', `${window.location.origin}/auth/resume`);\n\nwindow.open(auth.toString(), 'ekoAuth', 'popup,width=480,height=720');\n```\n\n### 3) Listen for the message in your app\n\n* Verify **`state`** matches, if required.\n* Resume your flow (e.g., code exchange with PKCE).\n\n```js\n// Boot-time listener\nwindow.addEventListener('message', (event) =\u003e {\n  if (event.origin !== 'https://redirect.eko.in') return; // strict check\n\n  const msg = event.data;\n  if (msg?.type !== 'EXTERNAL_TOOL_REDIRECT') return;\n\n  const params = msg.params || {};\n  const expected = sessionStorage.getItem('oauth_state');\n  if (!expected || params.state !== expected) {\n    console.warn('State mismatch; ignoring payload');\n    return;\n  }\n  sessionStorage.removeItem('oauth_state');\n\n  // Continue your flow (exchange code, handle tokens/errors, etc.)\n  // exchangeAuthorizationCode(params.code, codeVerifier) ...\n});\n```\n\n## Repository Structure\n\n* **`/redirect.html`** — the shared callback page (static).\n* **`/examples/`** — minimal demo app showing opener → redirector → message flow.\n* **`/docs/`** — integration notes, provider quirks, security checklists.\n\n---\n\n## Integration Patterns\n\n### Embedding `target_origin` \u0026 `return_to` in `state`\n\n* Encode `{ target_origin, return_to, nonce, exp }` into a **signed** state (JWS/JWT).\n* On receipt, your app decodes and verifies it; the redirector remains generic.\n\n### Multiple values per key\n\n* The redirector preserves duplicates (arrays). Your app should accept both **string** or **string\\[]** for each key.\n\n---\n\n## Browser Support\n\n* `window.opener.postMessage` — broadly supported.\n* Auto-close requires the popup/tab to be **opened by script** (user gesture).\n* Fallback navigation covers cases where `opener` is missing or blocked.\n\n---\n\n## Troubleshooting\n\n* **Tab didn’t close** → Ensure popup was opened from a **user gesture** and not blocked by the browser.\n* **No message received** → Check `event.origin`, allowlist, and confirm provider returned `target_origin` (or that your app recovered it from `state`).\n* **State mismatch** → Make sure you store the request `state` (e.g., `sessionStorage`) *before* opening the popup, and clear it after success.\n\n---\n\n## Roadmap\n\n* **Telemetry hooks** (success/error counters; no secrets).\n* **Provider adapters** (docs for common OAuth quirks).\n* Serve it via a tiny server/edge function (`/server`) that injects an **allowlist** of permitted `target_origin`s.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekoindia%2Fredirect-hub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fekoindia%2Fredirect-hub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekoindia%2Fredirect-hub/lists"}