cameronm
CCConvex Community
•Created by Heath on 9/12/2024 in #support-community
Setting auth from within an HTTP action
@sshader I am running into the same issue. I am using Hono to build a REST API, and I want to use Hono middleware to authenticate the user. You're article on this was very helpful btw so thanks for that!
Already can get the access token in through http only cookies as well as Bearer token to give the end user multiple options to send their credentials, but can't find a way to pass the token to convex auth to identify the user other than the hack you mentioned above making an additional fetch call with the Authorization header.
That hack feels kind of clunky especially since we're checking auth state on every request, and seems like it would result in additional function calls or action compute. Would this be the case with that workaround?
14 replies
CCConvex Community
•Created by gioru on 8/27/2024 in #support-community
Need help with handling Convex Auth signIn errors in prod
@ballingt yes, agree with the instanceof. Should have added I am mainly doing this with an HTTP Api using HTTP Actions and not a Convex Client. So I am handling all errors on the server and just returning the appropriate responses.
The client solution is definitely a trickier one with the reactivity and not exposing sensitive information.
30 replies
CCConvex Community
•Created by gioru on 8/27/2024 in #support-community
Need help with handling Convex Auth signIn errors in prod
@ballingt @gioru I ran into a similar issue. Even on the server, the errors returned are difficult to handle in try catch blocks as they are just the standard Error class. Sometimes the message is like a code, for instance 'InvalidSecret', but its inconsistent
Would be nice even if these were custom named Error classes to check with instanceof to better handle some of the expected error types like @gioru is checking with string checks
for example if (error instanceof ConvexAuthTooManyFailedAttemptsError)
A little verbose, but you get what I mean. Or create a custom ConvexAuthError or ConvexServerError class extending Error with some additional details like a code that can be documented somewhere in the docs so we have a reference of expected errors to handle
30 replies
CCConvex Community
•Created by cameronm on 8/27/2024 in #support-community
auth:store signUp Error with duplicate email
My auth.ts file isn't overly complex. I am just setting this up as a basic test. I know the callback isn't being executed because my log stream never shows the "Caught" log in the catch block.
2 replies
CCConvex Community
•Created by cameronm on 8/21/2024 in #support-community
Convex Auth user table fields
Ok, so if I do want those as nulls, I have to define my schema to accept nulls, and set them to null using that after create callback or w.e
Thanks I'll take a look at those docs
12 replies
CCConvex Community
•Created by cameronm on 8/21/2024 in #support-community
Convex Auth user table fields
Ya, it is. But if it is unset, it isn't getting returned.
Ok, so unset is not the same as null?
12 replies
CCConvex Community
•Created by cameronm on 8/21/2024 in #support-community
Convex Auth user table fields
I am using convex auth, and I am only using Password
12 replies
CCConvex Community
•Created by cameronm on 8/21/2024 in #support-community
Convex Auth user table fields
Ah, it seems like unset fields are not returned. I thought it would return null?
12 replies
CCConvex Community
•Created by cameronm on 8/21/2024 in #support-community
Convex Auth user table fields
The data is unset for a lot of those on my test user.
I might just create a user_profiles table with a link to the user to store my metadata about the user so I don't mess around with the auth tables too much
12 replies
CCConvex Community
•Created by kstulgys on 8/4/2024 in #support-community
can I use convex auth with hono?
Ah cool, ok. I'll play around with both approaches to see which mental model works better for me lol. Thanks for your help!
10 replies
CCConvex Community
•Created by kstulgys on 8/4/2024 in #support-community
can I use convex auth with hono?
@Michal Srb Actually the above code you shared works to ensure the auth routes resolve correctly with the hono router 😀 .
RE that article. So if I am understanding the second method in that article correctly, we are basically passing any incoming http requests to the hono router with the action context?
10 replies
CCConvex Community
•Created by kstulgys on 8/4/2024 in #support-community
can I use convex auth with hono?
@Michal Srb Any more thoughts on this? I can get everything with hono working great, but the /.well-known/openid-configuration and /.well-known/jwks.json paths from convex auth routes don't play well and always return null for the user
I did a test of the above as well and there is a type error on c.req when calling httpAction
Argument of type 'HonoRequest<"/.well-known/jwks.json", unknown>' is not assignable to parameter of type 'Request'.
Type 'HonoRequest<"/.well-known/jwks.json", unknown>' is missing the following properties from type 'Request': cache, credentials, destination, headers, and 10 more.ts(2345)
10 replies
CCConvex Community
•Created by cameronm on 8/21/2024 in #support-community
Service Outage?
No more issues!
7 replies
CCConvex Community
•Created by Jolo on 8/19/2024 in #support-community
Convex Auth without React?
This seems to be more of a documentation issue rather than anything else. Understandable since this is a new feature. Can implement this looking at existing source code for the react and next.js implementations. Is there any roadmap on extending the docs and implementing integrations for other frameworks?
8 replies
CCConvex Community
•Created by Jolo on 8/19/2024 in #support-community
Convex Auth without React?
@Michal Srb I have a use case that doesn't have to do with Astro specifically but just using Convex auth without React in general.
I am building a simple REST Api to be able to query the convex database. I don't want to set up a react or next.js app for this. Just a simple server using the httpRouter and middleware to check credentials before running queries and mutations
So I just want to set up some post and get routes to allow sign-up, sign-in, sign-out, get the current user, etc
This way I can just use Postman to test auth
This is just an internal app, and we're probably just going to use something like Retool to build the UI for speed so I don't want to added overhead of a next.js app right now
8 replies