jem
jem•2y ago

Custom Auth (for ATprotocol)

hihi! trying to implement a custom auth provider, and for some reason isAuthenticated is false even tho in my useAuthFromProviderX function (and my auth provider) it's true noticed this in the Clerk & Auth0 doc pages but not the Custom auth provider page - do I potentially need to add something to convex.json?
Debugging authentication If a user goes through the Auth0 login flow successfully, and after being redirected back to your page useConvexAuth gives isAuthenticated: false, it's possible that your backend isn't correctly configured. The convex.json file in your project directory contains a list of configured authentication providers. You must run npx convex dev or npx convex deploy after adding a new provider to sync the configuration to your backend.
12 Replies
jem
jemOP•2y ago
pushed what I have right now - to log in you need an atproto/bluesky account but my provider does work 🙂 https://github.com/babecottage/atproto-convex/blob/main/hooks/useAuthFromATP.ts
GitHub
atproto-convex/useAuthFromATP.ts at main · babecottage/atproto-convex
Contribute to babecottage/atproto-convex development by creating an account on GitHub.
jem
jemOP•2y ago
uh locally I also have my convex folder with a couple simple schemas but I haven't commited that yet also my auth provider - getToken returns a (stringified?) JWT
jem
jemOP•2y ago
GitHub
atproto-react/ATPProvider.tsx at main · babecottage/atproto-react
cute reusable helpers for ur besties' new favorite protocol - atproto-react/ATPProvider.tsx at main · babecottage/atproto-react
Indy
Indy•2y ago
cc @Michal Srb
jem
jemOP•2y ago
update: set up a whole buncha breakpoints and hit a dead end - it looks like WebSocketManager is receiving AuthError from the server when it calls Authenticate with my JWT. not sure what to try next! the jwt seems to be valid but i'm at the edges of my knowledge with this stuff 🙂 @Indy @Michal Srb oop should i move this to the support channel? srry i can’t read
Mikael Lirbank
Mikael Lirbank•2y ago
I also had a bunch of issues with Auth, not sure if this is helpful but this is what worked for me: https://discord.com/channels/1019350475847499849/1019350478817079338/1101687370610376744
Michal Srb
Michal Srb•2y ago
Hey @jem , do you have auth configured on your backend? To do this you can run npx convex auth add with the appropriate arguments for your auth provider. They should be written to convex.json and pushed to your backend with npx convex dev or npx convex deploy.
jem
jemOP•2y ago
@Michal Srb soooo maybe this just won’t work, but my auth provider hasn’t (currently) implemented oauth - i’m kinda hazy on it but it’s a login with a username & password in their React client, and it returns a JWT (which I wrapped in a provider and wrote a translator for it to work with ConvexClientWithAuth) which is to say - i tried running convex add auth but i have no idea what to tell it
jem
jemOP•2y ago
this is the main auth provider btw - babecottage/atproto-react is my wrapper for it https://github.com/bluesky-social/atproto/tree/main/packages/api
GitHub
atproto/packages/api at main · bluesky-social/atproto
Social networking technology created by Bluesky. Contribute to bluesky-social/atproto development by creating an account on GitHub.
ballingt
ballingt•2y ago
@jem will follow up on Bluesky, if this is an ID token we should be able to make this work! from looking into this a bit, sounds like this is a JWT but not an OpenID identity token, so not something that will work with Convex auth. That's what we need to check though, what does this JWT look like.
ballingt
ballingt•2y ago
from one Bluesky team member's perspective this isn't supported yet, but that doesn't mean not to investigate
No description
jem
jemOP•2y ago
oops idk how i missed this. i can decode the JWT later today 🙂

Did you find this page helpful?