Skip to content

[Bug]: redirectToLogin() fails on localhost #140

@gonengar

Description

@gonengar

Description

redirectToLogin() fails on localhost

Problem

When using the SDK and calling redirectToLogin(), if the app is running on localhost, the redirect fails.

Root cause: When appBaseUrl is not configured, redirectToLogin() creates a relative URL (/login?from_url=...) which resolves to http://localhost:3000/login - a page that doesn't exist on the local dev server.

Current behavior

// In auth.ts
const loginUrl = `${options.appBaseUrl ?? ""}/login?from_url=...`;
Environment appBaseUrl Result
Localhost not set /login → localhost:3000/login ❌
Production not set /login → works if app has /login route
Production set {appBaseUrl}/login ✅

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions