-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add official Express.js support to auth/core #8257
Comments
Thanks for putting this issue together @hillac! As the creator of the demo repository I would also love to see official support and community efforts on the logic required to translate between Web Request/Response APIs and Express' APIs. I have brought it to a working state in my repository, but more hands and eyes on it would improve its quality and make it more useful to the community. I think being added as a Thanks! |
As far as I can tell, all we need is a wrapper around If someone opens a PR, we could discuss further there. As for documentation, we prefer JSDoc, that we can then use to auto-generate our docs site. See https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/index.ts for an example. Rendered here: https://authjs.dev/reference/core Looking forward to |
Thank you for the comments and guidance @balazsorban44 馃檶! You鈥檙e right, the translation wrapper should be all that is needed, and is taken care of in the demo! @hillac, what do you say to pairing together to put together a PR for review and discussion? We can follow closely, the standard setup in frameworks-x directories, and follow the approach from the demo. Also @balazsorban44, there were some more specific pieces such as having a body parser middleware in the app to make the translation fully possible. I will call these out in the JSDoc and PR to make sure we鈥檇 be taking the right approach there. Thanks to you both again 馃憤! |
Yep sounds good. |
cant' tell you how much im looking forward to drop kicking passportjs in my nestjs application in favor of this.... |
Thank you for working on this! 鉂わ笍 |
It's pretty much done #8354. |
Description 馃摀
I've seen several issues / posts related to support for express.js and want to use it myself. I would like to propose adding express as an officially supported framework. Given the intention to support more frameworks, I think it would be worthwhile bringing direct support for Auth.js to the most popular back end javascript framework.
Here is an example implementation: rexfordessilfie/authjs-express-demo, which implements a translation layer for the web standard api request/response to express requests/responses, and express middleware for JWT authentication. So support seems quite straightforward.
I'd be willing help with this / add documentation for using express. If this feature is not accepted, I'm also happy to just write docs for using it like in authjs-express-demo if anyone else considers that worthwhile.
Some links to related issues:
Can auth.js be used with vite + node.js express backend?聽#8158
Vanilla setup聽#7647
Unable to use @auth/core with node.js frameworks like express/hapi聽#6417
For older versions:
On reddit:
How to reproduce 鈽曪笍
https://github.com/rexfordessilfie/authjs-express-demo
Contributing 馃檶馃徑
Yes, I am willing to help implement this feature in a PR
The text was updated successfully, but these errors were encountered: