Skip to content

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

Description

@Gautam25Raj

Affected Apps / Packages

Portfolio (apps/portfolio), Studio (apps/studio)

Metadata

  • Suggested Branch: feat/auth-guest-mode-redirection
  • Suggested PR Title: [Feature] [Auth]: Require login redirect with callback for guest access

Is your feature request related to a problem?

Yes. Unauthenticated users are currently assigned a guest cookie automatically. We want them to see the login page first before entering guest mode.

Also, guest users in the portfolio dashboard must be allowed to edit and preview their work, but the publication action should be locked.

Describe the solution you'd like

  1. Update studio/proxy.ts to redirect users without session or guest cookies to /login for all dashboard routes, bypassing only /login, /share, /api, static files, and _next. Remove automatic guest cookie assignment.

  2. Update portfolio/proxy.ts to block access to private routes (like /dashboard and /editor) if the user lacks a session and does not have the guest cookie.

  3. Update login/page.tsx guest access action to set veriworkly-guest-mode=true on the shared domain (.localhost or .veriworkly.com) and redirect to the callbackURL search parameter.

  4. Update portfolio-store.ts loading sequence to gracefully handle 401 rejections from the server during guest visits and avoid synchronizing draft changes to the database.

Describe alternatives you've considered

Using server actions to write the cookie, but a client-side setting during the "Continue without login" action is simpler and handles the multi-domain redirect immediately.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfrontendUI/client-side code

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions