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

Middleware Data and Redirection without Raw. | Encore Port of Better Auth #1683

Open
solarsoft0 opened this issue Jan 6, 2025 · 3 comments

Comments

@solarsoft0
Copy link

solarsoft0 commented Jan 6, 2025

Related PR: #1631

First, the way middleware works makes it a great fit for TypeScript to shine in encore.ts, unlike how it is required to be expressed in Go. The arrangement also complements this.

I decided to port Better-Auth to support Encore natively. but, here is the blocker delaying progress without resorting to api.raw, as I want to leverage all of Encore's benefits:

Blocker:

  • The ability to set and get data in middleware.
  • The ability to redirect either in a handler or in middleware.

I would have asked for Zod support, but I noticed that removing Zod resolved the issue and made it more Encore-native. While I suspect there might still be some limitations, things are moving smoothly so far. I also aim to use this issue to track any problems if I come across any.

I believe this will be a valuable contribution to the community at large, enabling developers to quickly spin up authentication for their projects without sacrificing what makes Encore interesting or relying on external services. You can read more about the motivation for this project here: solarsoft0/encore-better-auth#1

I currently have a copy in my personal project that I am working with, and I plan to sync it with the repo once things are stable. Considering the urgency of getting authentication out of the way, I may resort to a forklift migration, which I would rather avoid. I would greatly appreciate it if we could resolve these issues as soon as possible.

Thank you for making this amazing framework!

@fredr
Copy link
Member

fredr commented Jan 7, 2025

I think #1631 should solve both the problems. Redirects will be possible through custom status code and setting headers

@solarsoft0
Copy link
Author

yeah, I am currently using a forklift migration, and it feels like a black hole. maybe I'm getting too used to encore, I would love us to see this through as soon as we can, I will keep this issue up, to track anything else I may come across until we have encore-better-auth. thanks! @fredr.

@fredr
Copy link
Member

fredr commented Jan 8, 2025

The middleware pr have been released now (version 1.45.3), you can update encore by running encore version update

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

2 participants