-
Notifications
You must be signed in to change notification settings - Fork 209
Support at+jwt auth token #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you give an example or provide more information about this OIDC standard token type? Supporting logto from Convex seems like a great idea. Have you tried it? Convex supports any provider supporting OIDC https://docs.convex.dev/auth/advanced/custom-auth What happens when you try it with Logto? |
The access token is a JWT token. Its main advantage is that it contains the "scopes" (in addition to the user ID and other information that can be added manually). The "scopes" a string with all the permissions linked to a user based on their role (e.g., "read:logs, write:logs, read:users, write:users"). For more information about access tokens: https://blog.logto.io/understanding-tokens-in-oidc and https://auth-wiki.logto.io/access-token. With Logto, I can create permissions (scopes) and assign them to roles. Then each user can be assigned one or more roles and thus have the corresponding permissions. Logto allows separating scopes by API resources. Regarding integration with Convex, I consider my Convex database (an excellent product, by the way, thank you very much!!) as an API resource. My goal would be to send the access token directly. This way, in my Convex functions, I can directly verify whether a user has access to a function via the access token without any fetch. Regarding integration with Logto, I have indeed succeeded with the ID token (the standard JWT with the user's basic information). It integrates very well with Convex (see https://discord.com/channels/1019350475847499849/1184230782370320396). The only thing missing, which would be fantastic, is support for the The reason I chose Logto is that it can be self-hosted (very important, like Convex), is straightforward to use, and has a management API. I didn’t want to use Clerk or Auth0 because they are not self-hostable. As for Convex Auth, I had to set it aside because I use SvelteKit, not React. I strongly recommend adding Logto integration to the documentation. |
Hi @nipunn1313, |
Broadly seems reasonable to add support for a new JWT token format - but I am struggling to find any documentation about what this at+jwt token is? Neither of the links you sent referenced it. It would likely have to go in here https://github.com/get-convex/convex-backend/blob/main/crates/authentication/src/lib.rs#L430 - would you like to try to implement it and test it out? If you can implement it and link to documentation explaining the at+jwt type, that seems reasonable. |
@pierre-H we're starting to support things like this; could you take a look at https://docs.convex.dev/auth/advanced/custom-jwt and see if that fits? |
@nipunn1313 : here is the RFC : https://datatracker.ietf.org/doc/html/rfc9068#section-4 . The RFC 9068 is about Access tokens. @thomasballinger : I tried, and I still have the error: |
@pierre-H you'll still need to use the type "customJwt", but you may be able to make this work by setting the other fields; would love to hear how this goes! |
Hey @thomasballinger. Trying to set up the custom jwt provider with better-auth, but the example config from the docs fails to deploy: Ideas? |
Hi @juliusmarminge, |
@pierre-H what does an I chatted with @juliusmarminge separately, more docs coming on custom jwt auth soon. |
@thomasballinger it' something like : {
"email": "[email protected]",
"username": "pierre-H",
"jti": "xxx",
"sub": "xxx",
"iat": 1747205352,
"exp": 1747208952,
"scope": "order:read order:write stock:read",
"client_id": "xxx",
"iss": "https://instance.convex.com/oidc",
"aud": "https://instance.convex.com",
} The most important part are:
In logto, we configure this in the Api Resources section. |
It looks like this would work with customJwt, although not sure that exposes scope yet. I'm documenting this new flow this week, if you get a chance to try this let me know and I can explicitly mention it. |
Thank you, @thomasballinger! As soon as the documentation is updated, I will try it. |
It would be great to support JWT with the
at+jwt
type (OIDC standard).For example : Logto access tokens are
at+jwt
tokens.The text was updated successfully, but these errors were encountered: