Tyler
Tyler
TTCTheo's Typesafe Cult
Created by Tyler on 11/5/2023 in #questions
Nextauth jwt configuration
I am making a simple task manager application using google apis with the t3 stack and I am having difficulty getting the user id from my session. I have my session strategy set to jwt because of token issues I was encountering with oauth. Currently, I have a task router, which uses a protected procedure to create a new task in my db, which requires a userid, title, and category. I'm pretty confident that my issue is surrounding jwt, in that when I create a task on the front end I get an error stating that my userid is undefined. I've tried passing the id as input, but the issue pertains to the session, so that also results in the userid being undefined. I am going to put my config below. The error: tRPC failed on task.add: Invalid prisma.task.create() invocation: { data: { title: 'fffffff', category: '', userId: undefined, + user: { + create?: UserCreateWithoutTasksInput | UserUncheckedCreateWithoutTasksInput, + connectOrCreate?: UserCreateOrConnectWithoutTasksInput, + connect?: UserWhereUniqueInput + }, ? createdAt?: DateTime, ? updatedAt?: DateTime } } Argument user for data.user is missing. Note: Lines with + are required, lines with ? are optional.
2 replies