Adding an identity provider to self-hosted Hoppscotch: what happens to guest-mode collections?
0 reputation · 05 Feb 2021, 22:15 UTC
0 reputation · 05 Feb 2021, 22:15 UTC
The goal is to restrict a self-hosted Hoppscotch Docker deployment so that collections and environments are not reachable by anyone who can open the instance URL, while preserving data a team member created while the instance ran in guest mode.
Self-hosted Hoppscotch moves request data server-side once accounts and workspaces exist, but a Docker install without a configured identity provider may leave the backend reachable to anyone who can open the URL unless access is restricted elsewhere. The transition from guest use to authenticated use is the uncertain part: whether browser local-storage collections migrate to the account, stay browser-only, or surface in a default workspace is not clearly settled and should be verified against the release notes for the version being deployed. This assumes a current self-hosted Docker distribution; exact defaults may differ between deployment layouts.
35775 reputation · 06 Feb 2021, 04:38 UTC
Enabling an identity provider does not touch the data that was stored only in the browser. Guest‑mode collections remain client‑side and are not automatically migrated to the new account or workspace.
In a self‑hosted Hoppscotch deployment the backend only persists data for authenticated users. Without an identity provider the API accepts unauthenticated requests, but it does not create a user record or a workspace. Collections that were created in guest mode live in localStorage under the key hoppscotch_collections. When an identity provider is later added, the server starts rejecting unauthenticated requests (unless you keep the default ALLOW_UNAUTHENTICATED flag), so the browser can no longer reach the API to auto‑save those collections.
401 Unauthorized.Open Hoppscotch while still in guest mode. Create any collections you want to keep.
From the Collections sidebar, click the three‑dot menu on a collection and choose Export. Save the JSON file.
Stop the Docker container and add your identity‑provider configuration (e.g., AUTH_PROVIDER=google and related client IDs). Restart the container.
Verify that unauthenticated requests now return 401 by hitting /api/collections without a token.
Log in with the new provider, go to the Workspace view, click Import and load the JSON file you exported. The collection will appear in the default workspace.
Repeat for any other collections or environments you exported.
Optionally, delete the old local‑storage data by clearing the browser cache or using hoppscotch_collections key.
If you had generated shareable URLs while in guest mode, those URLs will no longer work after authentication is enforced. The only way to keep them functional is to re‑share the collection from the authenticated workspace, which will create a new shareable link.
401 responses after enabling authentication.Could you let me know which Hoppscotch Docker image/tag you are running? The default behaviour may differ between releases, and the migration steps above assume the current stable version.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.