iedan
BABetter Auth
•Created by iedan on 4/28/2025 in #help
Is it possible to get the user id from the cookie without having to verify to user and hit the DB?
Right now I have a call to the database that will check if the user with the id has access to the resource being requested. Because of this I need to get the session which can take ~200ms uncached. I don't really need to verify the user is valid before I get the resource and it would speed things up quite a bit if I could just do that at the same time as I am getting the resource.
Is it possible to just get the userId from the cookie / apiToken without having to hit the DB first?
Right now the code looks something like:
but ideally I could do something like:
6 replies