Authentication and Data Posting Issues in Next.js 13 Chat Application with next-auth and Prisma Client

17 Views Asked by At

I am currently developing a chat application using Next.js 13 with next-auth and Prisma Client. the code is in thisrepository.

Authentication in API Endpoints

I have encountered an issue with authenticating users in my API endpoints using getServerSession(authOptions)(always returns null in api endpoints). This problem is similar to the one discussed in this issue, where the proposed solution was to call the authentication function directly.

Data Posting

there are only two options to post data which is using server actions or posting the data directly from the client component. However, I am hesitant to use server actions as they may not be stable yet. Can I safely use PrismaClient() in the client component, or does it pose a risk of leaking sensitive information?

is there any solution?

0

There are 0 best solutions below