Skip to content

Conversation

@te2wow
Copy link

@te2wow te2wow commented Feb 12, 2026

Fixes #1104

When basePath is set to an absolute URL like http://localhost:8000/api/auth, the URL is built by simple string concatenation (${baseUrl}${basePath}/${path}), resulting in a broken URL like http://localhost:3000http://localhost:8000/api/auth/session. This PR adds normalizeBasePath() in client.ts that splits an absolute URL in basePath into baseUrl and basePath, so that the URL concatenation produces the correct result.

Changes

  • client.ts: Add normalizeBasePath() function
  • react.tsx: Use normalizeBasePath() in AuthConfigManager.setConfig()
  • client.test.ts: Add tests for normalizeBasePath()

The author should do the following, if applicable

  • Add tests
  • Run tests
  • yarn changeset at the top of this repo and push the changeset
  • Follow the contribution guide

@changeset-bot
Copy link

changeset-bot bot commented Feb 12, 2026

🦋 Changeset detected

Latest commit: 7c311a6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hono/auth-js Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.71%. Comparing base (96ae310) to head (9aaf63c).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1743      +/-   ##
==========================================
- Coverage   92.68%   91.71%   -0.98%     
==========================================
  Files         112      113       +1     
  Lines        3733     3778      +45     
  Branches      946      954       +8     
==========================================
+ Hits         3460     3465       +5     
- Misses        245      281      +36     
- Partials       28       32       +4     
Flag Coverage Δ
auth-js 64.34% <100.00%> (-34.23%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[@hono/auth-js] basePath can not be set to an absolute path

1 participant