You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use next-auth on the frontend backed by a Rails API. The JWT tokens generated by the frontend use a signingKey (see docs). The key looks like this:
$ jose newkey -s 256 -t oct -a HS512
{"kty":"oct","kid":"kigxq6S4B7X4-wTxbqEJMYLYVid-BjW4SZMMm6wSC3c","alg":"HS512","k":"ghBlGxKq9CcDYDG7XUHmquoBc-mrMXWfpZcPYnMihBQ"}
I can't get the tokens generated by the frontend to verify in Ruby (Signature verification raised), and I'm unsure how to plug this key into ruby-jwt. The tokens seem to verify ok in jwt.io. Any advice as to how I should use this kind of JSON key in addition to (or instead of?) the secret in ruby-jwt?
I've figured this out - the signing key created via jose newkey -s 256 -t oct -a HS512 is using type oct, but the ruby-jwtdocs state that it Currently only supports RSA public keys.
To use ruby-jwt with next-auth:
Creating an rsa signing key (jose newkey -t rsa)
Add the signingKey as a JSON string in next-auth config (see docs).
Decode in ruby via:
jwks = { keys: [<INCLUDE SIGNING KEY HERE AS A RUBY HASH, NOT A JSON STRING>] }
JWT.decode(token, secret, true, { algorithms: ['PS256'], jwks: jwks })
Hi @recurser . NextAuth dropped the support of signingKeys in V4. Did you upgrade your Rails app? If yes, how did you do that? Would be nice if you can provide some example code. I thought maybe dropping ruby-jwt and implementing some jwt gem which supports the encryption method NextAuth suppprts.
Thank you in advance
I'm trying to use next-auth on the frontend backed by a Rails API. The JWT tokens generated by the frontend use a
signingKey
(see docs). The key looks like this:I can't get the tokens generated by the frontend to verify in Ruby (
Signature verification raised
), and I'm unsure how to plug this key intoruby-jwt
. The tokens seem to verify ok in jwt.io. Any advice as to how I should use this kind of JSON key in addition to (or instead of?) the secret inruby-jwt
?On the ruby side I'm doing this:
The text was updated successfully, but these errors were encountered: