Kseikyo
TTCTheo's Typesafe Cult
•Created by Kseikyo on 9/2/2023 in #questions
Context on middleware always undefined
I'm trying to use trpc with next-auth using the GoogleProvider. I can sign in just fine,
publicProcedures
work, but all protectedProcedures
will throw UNAUTHORIZED
, even though when using the useSession
hook on the same component, it returns the correct data.
I can also see the session on prisma studio.
6 replies
TTCTheo's Typesafe Cult
•Created by Kseikyo on 8/28/2023 in #questions
TRPC and protectedProcedure with next-auth
Has anyone ever experienced an issue with a new t3 app with next-auth and trpc where a
protectedProcedure
for a mutation stays pending and multiple session requests are also pending when you're signed in?
I've also added a log to the middleware on the enforceUserIsAuthed
and it never seems to get called.
Also, when this happens I have to remove the .next folder and start the dev server again, otherwise clearing the site data and hard refreshing doesn't even load the page anymore.
The procedure works when it's a publicProcedure
4 replies
TTCTheo's Typesafe Cult
•Created by Kseikyo on 9/25/2022 in #questions
Prisma nexth-auth role based access control model
Hi, just getting started with the t3-stack and prisma. I'm a little confused on why the
Account
model is required for next-auth.
Also, I'm not sure how to add a role that would give me type definitions when using the session
.
Yes, I did looked it up and I followed the tutorial from next-auth, but that doesn't give me the type definitions on the user when setting up the session. https://next-auth.js.org/tutorials/role-based-login-strategy
Also, I've already changed the next-auth.d.ts
file to include the role.
Edit-1: Add next-auth types info;4 replies