How to setup Custom OIDC Auth (Logto)
Hi there, I'm not sure if I'm completely missing something or if something is misconfigured.
I'm attempting to use Logto (OIDC fully compatible) to authenticate with Convex. I have setup the
auth.config.js
file as:
(Don't worry, all these environments are purely for testing purposes, I'll swap them out before building anything "real")
And have called setAuth
(just using the BaseConvexClient
as I'm in Angular, not React) with:
And I've confirmed it's getting the token, but never logs in, nor do I see anyway to debug why it's not logging in (URL error, invalid token, ID10T error, something else??).
Any suggestions on where I should look? Based on the audit logs in Logto, Convex doesn't seem to ever even try to validate the token (or hit the Logto server at all)
Thanks! Really excited to try Convex for a new project, but need auth with Logto to work (their support for multi-tenancy and multi-organization is pretty key for what I'm building)25 Replies
Interestingly, I updated my logto config to correctly request the access token for this specific resource (i.e. convex) and now it just breaks the server. I see this in my logs:
And notably, the
console.log
from my convex query never appears, nor does the isLoggedIn
change callback fire
Don't see anything in the logs on the convex dashboard about it@mrvdot what's the name of the backend you're connecting to? It's possible we'll see better error messages than are exposed here.
@ballingt
acoustic-cassowary-66
, thanks!I can look into this more, but initially I see
huh, the first one you linked did not have this
Yeah, that was just the "idToken" originally
I was testing a "resource specific" token to see if that helped
One sec, I'll swich back to just the regular id token
Yeah, so regular ID token is the standard
JWT
type, but still doesn't authenticate:
https://jwt.io/#debugger-io?token=eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCIsImtpZCI6IlYyX084Sm01X0JEY3NMQXpPYVZOYUVTajlvcjBKZ05mT3ZUQU5CUWRtWGMifQ.eyJzdWIiOiJ5b3NyMDU2d2huaGIiLCJuYW1lIjpudWxsLCJwaWN0dXJlIjpudWxsLCJ1c2VybmFtZSI6bnVsbCwiYXRfaGFzaCI6IjB4UmR3enVNZDB6WjZRT1FMLXdYUVdKN3NwblNpWU9WIiwiYXVkIjoieXQzZnczc3g1ZWE4OXRwNngyN25iIiwiZXhwIjoxNzAyNDM3NDc0LCJpYXQiOjE3MDI0MzM4NzQsImlzcyI6Imh0dHBzOi8vZ3VxNnNnLmxvZ3RvLmFwcC9vaWRjIn0.ivw5AxZiL80UedrStw9EAZLSsejfbCjl75_jCfFiEn1IBZ53fTRcajFNcicwXhon-S2FrmW1QTkQOWl5k8-qA0BcUf4ViP65DvyIY1M4gO_IiAHe1nK_Wntw9LLOiiSw&publicKey=%7B%0A%20%20%22crv%22%3A%20%22P-384%22%2C%0A%20%20%22kty%22%3A%20%22EC%22%2C%0A%20%20%22x%22%3A%20%22dJAmN0qVDL_Vx4DIwxVmeF1Kx-ZUhyy9YZmvibwMaThVc-j-0mjsv8ulg8ef1zcN%22%2C%0A%20%20%22y%22%3A%20%225oHgP4Iuuul3vmNUjQeemb4WNVuCYJ15tvsUqzfEPFVIOKIxSuZM4BvqWRrvYhqZ%22%0A%7DI also see some
and
but I'll check out the newest errors, makes sense if you've been trying things
The first error is probably because I was sending the access token, which is just a regular string, rather than the ID token, which is an actual JWT
The latter is probably the issue, but it'd be helpful to know exactly what "provider" it was looking for
The
aud
in the JWT matches the applicationID
in the auth configin the last minute I see
and
and
the middle looks interesting, I wonder if we can support that
Hmm, the alg says
ES384
I see
ECDSASHA384
in the bottom sectionI think that's just the function for verifying.
The algorithm is still
ES384
(you can see it at the top)
Yeah, that's just something JWT.io suggests. If you do a "boring" JWT decode, that's not in there:
https://www.jstoolset.com/jwt/6a104097b60be175ah thanks
Poking around some other OIDC setups, it looks like maybe the
at_hash
requires an additional accessToken
for full validation: https://supabase.com/docs/reference/javascript/auth-signinwithidtokenNot sure if that's necessary or just recommended
Our Clerk example uses "convex" as applicationId, but I believe that's because that's what they put in the aud field https://github.com/get-convex/convex-demos/blob/main/users-and-clerk/convex/auth.config.js
Yeah, that was my understanding as well
is the only error I see for the last 20 min
(sorry about these not being exposed!)
Ok, yeah, that does seem like the mostly likely culprit
Any chance you can see/log how exactly it's trying to match the provider?
I tried using the iss field and that also caused an error
*for the domain in the auth config
taking a look
Thanks
Hi guys. I am trying to implement Logto auth too and not sure how to do so. @mrvdot Did you succeed in implementing this ? Please advise 🙂