Squirble
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
Btw, it only works if I set some kind of identifier on the user, like a username, email, or phone number. Since I don't have any of that, I'm using the convex ID for my local user row as the clerk username. Kind of a hack working around that limitation...
117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
Integrating with clerk means perhaps I can use other types of auth later, since I want to integrate with other types of messengers that maybe clerk will actually help with :P. Unfortunately Telegram doesn't give any sort of universal identifier like email or phone number though so idk how I'd detect duplicate users authenticating in two different ways unless the user intentionally merges theirself shrug but I guess the poll runners could decide which auths they want to allow.
117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
just to identify the user instantly. I'm making a poll app so I want each user to get one vote.
117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
It's working =]
117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
ah I see, they are also available in
@clerk/clerk-react
117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
er, I guess this part is nextjs specific and needs to be something else:
117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
looks like a regular react component to me
117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
Ah I guess it doesn't really require nextjs does it?
117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
So how do I build this custom token sign in flow with just react and convex?
117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
yeah I posted the question
117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
Man, I really think I can make this work where I just forge a clerk jwt essentially, since it lets you provide your own signing key. Perhaps I'm not putting in my signing key correctly though because it's breaking its normal operation. Don't see docs on what format the signing key is supposed to be inputted.
117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
I wanna try just generating a clerk-compatible JWT. I generated a custom signing key pem but convex doesn't seem to preserve newlines when i paste it in...
117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
The Clerk solution you're describing is kinda stateful, right? I assume it would cause Clerk to temporarily store some information to represent the login token you generated?
117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
Well for OpenID Connect I'd just have to implement those two http actions:
/.well-known/openid-configuration
and /.well-known/jwks.json
right?117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
Can I generate a JWT that clerk will believe is valid? It seems I can set a custom secret in clerk....
117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
even if I wrote a custom
useQuery
hook I'd still not be able to use convex.auth.getUserIdentity
on the server side, right?117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
Honestly considering just writing an OpenID endpoint to make convex happy so I can do the auth in one place and then not have to think about it in the rest of the app.
117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
So this would have to be an explicit argument in every single action/query/mutation?
I'll even have to pass it and re-verify if an action calls other queries or mutations.
Definitely not as convenient as just checking
convex.auth.getUserIdentity
. Is there no way to hook into that?117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
Is it possible to do something like without
"use node"
? And if so, how would I get convex to pass my telegram init data with every action/mutation/etc or would I have to do that manually?117 replies
CCConvex Community
•Created by Squirble on 12/15/2024 in #support-community
Telegram Authentication
https://github.com/grammyjs/validator?tab=readme-ov-file#web-bots-validation
This package implements the verification in
validateWebAppData
. It's not terribly complicated: https://github.com/grammyjs/validator/blob/main/src/mod.ts#L13-L28 but it does use sha256
https://github.com/grammyjs/validator/blob/main/src/deps.node.ts117 replies