Skip to content

[Feature] [Auth]: Require login redirect with callback for guest access - #194

Merged
Gautam25Raj merged 3 commits into
masterfrom
feat/auth-guest-mode-redirection
Aug 16, 2026
Merged

[Feature] [Auth]: Require login redirect with callback for guest access#194
Gautam25Raj merged 3 commits into
masterfrom
feat/auth-guest-mode-redirection

Conversation

@Gautam25Raj

Copy link
Copy Markdown
Collaborator

Closes #175

Summary of Changes

  1. Studio Proxy (apps/studio/proxy.ts):

    • Redirect unauthenticated users without session or guest cookies (veriworkly-guest-mode=true) to /login with callbackURL preserving path and query.
    • Bypass only /login, /share, /api, static files, and _next.
    • Remove automatic guest cookie assignment.
    • Maintain protected route restrictions for account-sensitive routes (/admin, /profile/master, /profile/advanced).
  2. Portfolio Proxy (apps/portfolio/proxy.ts):

    • Require session or guest cookie (veriworkly-guest-mode=true) for private routes (/dashboard, /editor, /preview, /settings, /analytics, /profile, /billing).
    • Unauthenticated visitors without guest cookie are redirected to ${siteConfig.links.app}/login?callbackURL=....
    • Keep public routes (/, /pricing, /portfolios, /user, /portfolio, /templates, /faq) accessible without auth or guest cookies.
  3. Login Page Guest Access (apps/studio/app/login/page.tsx):

    • When users click "Continue as Guest", sets veriworkly-guest-mode=true cookie on the shared domain (.localhost or .veriworkly.com).
    • Redirects to getSafeAuthCallback(callbackURL) handling cross-origin destinations via window.location.href.
  4. Portfolio Store (apps/portfolio/store/portfolio-store.ts):

    • In loadWorkspace, gracefully handle 401/404 rejections by transitioning to guest mode with local cached state without throwing unhandled exceptions or attempting cloud database synchronization.
    • Guard publish() and unpublish() actions against unauthenticated guests.
  5. Testing & QA:

    • Updated and added contract and unit tests in both apps/studio and apps/portfolio.
    • Verified that Prettier formatting and ESLint checks pass.

- Update studio proxy to redirect unauthenticated visitors without guest cookie to /login with callbackURL, bypassing /share, /api, static files, and _next

- Remove automatic guest cookie assignment in studio proxy

- Update portfolio proxy to guard private dashboard and editor routes against unauthenticated users without guest cookie

- Update login page guest access action to set veriworkly-guest-mode=true on shared domain and redirect to callbackURL

- Update portfolio store to gracefully handle 401 rejections during loadWorkspace without syncing local drafts to cloud and guard publish

- Update unit and contract tests in studio and portfolio apps
@Gautam25Raj Gautam25Raj added enhancement New feature or request frontend UI/client-side code security Security concerns or fixes labels Aug 16, 2026
@Gautam25Raj
Gautam25Raj merged commit a2f765a into master Aug 16, 2026
11 checks passed
@Gautam25Raj
Gautam25Raj deleted the feat/auth-guest-mode-redirection branch August 23, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request frontend UI/client-side code security Security concerns or fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Require login redirect for guest users and handle returning callbacks

1 participant