feat: add next-auth package
con: doesn't work with expo yet :/
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
| Name | Status | Preview | Updated |
|---|---|---|---|
| create-t3-turbo | ⬜️ Ignored (Inspect) | Nov 5, 2022 at 11:23AM (UTC) |
Hi @juliusmarminge,
thank you for working on this! I've tried this next-auth integration in one of my current projects, and I have a few problems. Before writing I checked this branch and I got the same errors:
-
First a runtime error in the
apps/nextjs
-
Second in the api package when using a
protectedProcedurethe types of theSessiondoes not contain theuser.id. It seems that the override of thenext-authtypes made in thepackages/authis not in place in other packages
I'm not an expert of neither typescript or monorepos, but happy to help in any way possible :) So let me know if I can do anything to help make this branch work
Update:
- I was able to solve the first problem by adding
@acme/authto the list of modules that need transpilationwithTM(["@acme/api", "@acme/auth", "@acme/db"]) - As for the second problem, I kinda hack it by adding the
next-auth.d.tsin the list of inclusion in thetsconfig.jsonof the importing package. Example@acme/api tsconfig.json->include: [..., "node_modules/@acme/auth/next-auth.d.ts"]. By doing so the type forSessioninside thectxin aprotectedProcedurecontainsidproperty
The first solution can be used in the same way in this branch. As for the second solution I'm not sure it's the right way to do it.
Le me know what do you think. Bye 👋
Update:
- I was able to solve the first problem by adding
@acme/authto the list of modules that need transpilationwithTM(["@acme/api", "@acme/auth", "@acme/db"])- As for the second problem, I kinda hack it by adding the
next-auth.d.tsin the list of inclusion in thetsconfig.jsonof the importing package. Example@acme/api tsconfig.json->include: [..., "node_modules/@acme/auth/next-auth.d.ts"]. By doing so the type forSessioninside thectxin aprotectedProcedurecontainsidpropertyThe first solution can be used in the same way in this branch. As for the second solution I'm not sure it's the right way to do it.
Le me know what do you think. Bye 👋
You can file a PR into this if you want :)
Hi @juliusmarminge, I've created a PR on the auth branch with the above fixes. #48
Let me know if there is anything that needs to be changed :)
I believe it's in a working state right now. Feel free to scaffold from this branch and let me know if any issues arise. I'll go over the configuration a bit more before I'll merge it into main