Replies: 1 comment 1 reply
-
hey @osseonews , thanks for you feedback: Regarding your auth questions, please see here - does this answer your questions? https://sonicjs.com/authentication Upgrading dependencies - I do this periodically and a little behind ATM but will get to that asap. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Just want to say congrats on continuing to build this. Hadn't looked in a few months and you made really amazing progress. I've been working on something similar and you are way, way ahead. So I'll probably drop what I did, and use this, and maybe just contribute here.
BTW, do you plan to upgrade the dependencies? Some are old, e.g. Hono (>4) Lucia Auth to 3.0?
I'm also curious why you use Lucia auth to create the bearer token. The problem with Lucia is that you have to continue to hit the database to verify everything. I think the better option (all big companies do it this way), is that after you verify the login for the user with Lucia, you create a custom JWT based on an ENV secret, and send that back to the client. Then on every request back to the API endpoints, you jsut verify the JWT. This is more scaleable, especially if you are going to use Sonicjs as a headless platform to manage content on a website and you will be hitting the API alot to get data. Below is some basic code. From what I can tell now, the way you verify the auth, which is just a session in the databsae, on the Bearer with Lucia is that every request to the API gets the bearer and checks it against the database session. This is very intensive and will slow things down alot.
EDIT: I might be missing something here though. Apparently, all the API endpoints are accessible by a client without authorization? If so, the authorization is just for the admin backend? In that case, Lucia is fine. But, the problem is that you need some way to restrict access to the actual api endpoints, like posts. There should be some sort of public access token that allows client side applications to access this. I'm not sure how this logic is handled in this repo
Beta Was this translation helpful? Give feedback.
All reactions