KHRM
Explore posts from serversBABetter Auth
•Created by KHRM on 4/12/2025 in #help
Setting Admin Roll With Hook
here is my hook in my auth config
i checked that ctx.body.role = 'ADMIN' throughout this hook
but when the user is created in my database their role is 'USER'
I assume this comes from my
@default(USER)
on my prisma schema but why is this occuring if the role is set to user via the before hook?
originally I had this logic in databaseHooks but I moved it to hooks so that I can use the
required: true
flag on the [user][additional fields]
/* for now ill move logic back to databaseHooks */12 replies
BABetter Auth
•Created by KHRM on 4/11/2025 in #help
Implementing User Roles
Hello, I am trying to implement roles of USER, MODERATOR, or ADMIN
I find the admin and organization plugins a bit intimidating
but more importantly I am not sure if they are the exact use case for my roles
here is my current code
Is this a good approach? I have the default role as USER
Or should I be using the admin or organization plugins and adjusting them to fit my above requirements?
6 replies
BABetter Auth
•Created by KHRM on 4/9/2025 in #help
set cookie manually in next.js server action
I know there is a plugin to do this for me but i wanted to see if i could do it manually, i compared it to the cookie when i use the client instance and it seems pretty similar but my session is still undefined
do i have to use the plugin or am i missing something? i think i normalized enough to properly set the cookie
7 replies
BABetter Auth
•Created by KHRM on 1/14/2025 in #help
Adjusting Default User
By default it seems the user with drizzle adapter is just select * from user
but i dont want to return specific fields like updatedAt, where is this logic being done and how can i change it?
2 replies
PPrisma
•Created by KHRM on 10/3/2024 in #help-and-questions
Sorting by Relations
Hello, I am trying to introduce infinite scrolling im my application but I am running into an issue.
I am using Prisma ORM with sqlite through Turso
here is what I curently have
I sort the
events
after I get them, but if I am only grabbing 5 results at a time, its only going to sort those 5 (which means it may be sorted within itself, but it might not be the 5 earliest events)
here is a simplified version of my schema
How can I get all events sorted by their first event date, whcih is sorted by their date
example query result
note eventDates array may not necessarily be in order but this is covered by
38 replies
DTDrizzle Team
•Created by KHRM on 5/5/2024 in #help
Auth.js (next-auth) with Drizzle Provider Typescript
Hello so in the guide for the drizzle provider for Auth.js (next-auth) it says we can override the tables
for example if i want to give me my users table a password and role field
but then i run into a typescript error since the tables are typed in a specific way inside the adapter itself
4 replies
KKinde
•Created by KHRM on 4/11/2024 in #💻┃support
useKindeBrowserClient shows error
Hello,
I am using the useKindeBrowser client to recieve the
isAuthenticated
property
however when i am not logged in on the home page there is an error shown in the console.log is this intended behavior?, i just started my project and it already feels wrong haha (error is not shown if i am logged in)
2 replies