allen
allen15mo ago

Curious if theres been any thought to

Curious if theres been any thought to having a more formalized way of declaring authed queries and having the query client automatically skip those until the convex auth is fully initialized. I find myself having to do a lot of render blocking of components with queries to authed endpoints so they don't throw while the auth is initializing during first app load. I could add skip param to every query behind the auth wall, but that seems less than ideal. Any patterns or approaches here that I'm not thinking of?
10 Replies
allen
allenOP15mo ago
Dealing with auth continues to be my #1 pain point with Convex DX. Still would love to have this be a native feature of the platform and not having to stitch together third party providers and mesh them with convex's auth provider and manage multiple states between those providers. Not having to roll my own data structures and querying for auth context, even with the withUser wrapper, would be nice. I know I've talked @Jamie 's ear off about this in the past, but thought it would be worthwhile to run up the flagpole again that this remains my top request.
Indy
Indy15mo ago
Thanks for raising again Allen. Yes, this remains something we also are not satisfied with. We are considering whether we can go further along this path with Lucia: https://www.npmjs.com/package/@convex-dev/convex-lucia-auth https://github.com/get-convex/convex-lucia-auth/blob/master/DOCS.md
npm
@convex-dev/convex-lucia-auth
Convex database adapter for Lucia Auth. Latest version: 0.0.4, last published: a month ago. Start using @convex-dev/convex-lucia-auth in your project by running npm i @convex-dev/convex-lucia-auth. There are no other projects in the npm registry using @convex-dev/convex-lucia-auth.
GitHub
convex-lucia-auth/DOCS.md at master · get-convex/convex-lucia-auth
Convex database adapter for Lucia Auth. Contribute to get-convex/convex-lucia-auth development by creating an account on GitHub.
Indy
Indy15mo ago
Would further integration here be something you'd be interested in?
allen
allenOP15mo ago
I'll take a closer look at Lucia. I was thinking of taking a stab at something similar with https://auth.js.org/
Auth.js
Authentication for the Web.
allen
allenOP15mo ago
My preference would be first class support within the convex offering, much like Supabase. https://supabase.com/docs/guides/auth
Auth | Supabase Docs
Use Supabase to Authenticate and Authorize your users.
Indy
Indy15mo ago
Would love your feedback on our Lucia integration if you're so inclined. I found it pretty easy to work with. However, the client bits of that library are not compatible with React Native yet (something I know you've needed in the past).
Mikael Lirbank
Mikael Lirbank15mo ago
Hi @allen , I am so with you on this. We eventually built our own custom auth on top of Convex, so we're happy now, but I agree with you that auth is not straight forward and would benefit from some love.
allen
allenOP15mo ago
@Indy I'll take a closer look. RN is not apart of my current scope, but might be in the near future. @Mikael Lirbank I feel like I'm about getting there myself. Getting a new project off the ground would be 100x easier if this was rolled into the platform more seamlessly.
jamwt
jamwt15mo ago
would love to hear from you all if you have a chance to try the lucia approach, what you feel like is still missing compared to a hypothetical "custom" convex-provided auth solution
Mikael Lirbank
Mikael Lirbank15mo ago
The Lucia article was published after we started rolling our own auth, but I looked it through a few weeks ago when we did some major changes to our auth (moved from OAuth2 to passwordless). I believe Lucia is missing passwordless, so it was a no go for us then (I think, that's how I remember it).

Did you find this page helpful?