Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@hono/auth-js] certain redirects are broken due to headers not being copied #896

Open
williamrobertson13 opened this issue Dec 19, 2024 · 0 comments

Comments

@williamrobertson13
Copy link

williamrobertson13 commented Dec 19, 2024

As mentioned in honojs/hono#2681 (comment), the auth-js middleware sends back responses using new Response instead of c.body which causes the response headers to get lost in a production environment. This breaks server-side redirects and unfortunately isn't caught by the test suite since app.request doesn't mimic real networking conditions.

The fix here is to use c.body for returning responses, but I think there's something else that needs fixing since switching to that breaks several other tests which I can't figure out the reason for. Anywho, thank you and looking forward to hearing back!

Expected
GET /api/auth/callback/postmark?confirmationToken=abc on already used token -> 302 to /api/error?error=Verification

Actual
GET /api/auth/callback/postmark?confirmationToken=abc on already used token -> 200 response with no redirect

@williamrobertson13 williamrobertson13 changed the title [@hono/auth-js] server-side redirects are broken due to headers not being copied [@hono/auth-js] certain redirects are broken due to headers not being copied Dec 19, 2024
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

No branches or pull requests

1 participant