Credentials Auth with tRPC
I'm rebuilding a client's site with the T3 stack. We originally had to do away with NextAuth because we figured its
CredentialsProvider
wasn't going to work for us. Then we moved to Strapi and after using Strapi I decided I'm just gonna do it myself. <Insert Thanos GIF>
We still need to authenticate users based on username/password credentials, and I'm not sure how tRPC handles that within its ctx
since according to NextAuth docs (https://next-auth.js.org/providers/credentials) it doesn't store session data in the DB.Credentials | NextAuth.js
Overview
10 Replies
aforementioned thanos gif
the credentialsprovider doesn't handle anything
its a tiny shell for you to implement your own thing from scratch pretty much
i see, that makes a lot more sense. i can still store a session in db and fetch it later right?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
i got it to work as intended, i'll say that much. it was a bit different from session management as the credentials provider actually did cover that. i did have to manipulate the session data however
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Under NDA. Sorry but no-can-do
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
i actually didn't change any of that whatsoever. next-auth still handles the session and everything seems to work as intended. i havent had a lot of reason to fetch sessions on the trpc side but if i were to need it, i'd have to reimplement the aforementioned manipulation of data