Can't generate JWKS using 'ES256'
I want to create Postgraphile Schema using
createPostGraphileSchema
and pass the private key for JWToken verification. However this does not support better's auth default encyption algorithm.
Allowed ones according to their comment in interface SignOptions
:
12 Replies
Current approach: I just changed jwks key pair algorithm to 'ES256'
But when I try to access
http://localhost/api/auth/jwks
, I get:
jwt plugin config:
Is this a bug?
Is there a better solution to this problem?
the jwks table is empty, key is not generated
In case this is relevant...
My dependencies:
I can try to cook up some minimal example if this isn't some obvious mistake on my sideSolution
I think this is a bug.
Made a pull request
I am getting the same error
Im also using ES256
Same issue
Fix is probably not coming soon on the main branch, but u can switch to v1.3 branch:
I mentioned this in the ticket as well, but even with
"better-auth": "1.3.0-beta.9"
I'm getting the following error
SERVER_ERROR: JOSENotSupported: Invalid or unsupported JWK "alg" (Algorithm) Parameter valueOkay after deleting the items in the
jwks
table, I get
TypeError: non-extractable CryptoKey cannot be exported as a JWK
Let me update and see if it happens to me too
Yes this is when it tries to use old jwk, so you did the right move
It works for me, can't reproduce the error. I believe my tests would catch a break like that...
@adam-beck I'll need more info on your error, maybe I can help
What did you call?
Did you confirm its only happening for "RS256" and not other algorithms?
Mb, I reproduced it eventually, I'll look how it escaped testing first
It's RSA issue on endpoint
There is some typechecking it fails, becaues the
.kty
is always send as 'EC' for some reason
so it's like the algorithms are working, but sending config which one to use does notI'm not ignoring you but I'll be AFK most of today. I do know I didn't try any other algorithm.
Lol you're going to quickly go over my head. I'm so bad with authentication.
Nah, it's just I spend some time debugging this code, I'm 4 months experience into webdev at all, don't get impostor syndrome dude lol
I'll try to fix it today and post local fix if I am successful
I wasn't on point
@adam-beck
quickest fix for now is to go back to
1.3.0-beta.8
Someone made PR that broke mine and somehow it passes all the new testshttps://github.com/better-auth/better-auth/pull/3471
You can track it here
GitHub
fix(jwt): Reimplement fix that allows to generate JWKS with other a...
I'm afraid the test cases I've made in previous PR were insufficient. PR #2755 reintroduced issue #3218.
This is because tests checked internals, but didn't test the functio...
@adam-beck v1.3 was released and it has the fix
Oh wow really! That's awesome. Great work!