Skip to content

JWT signing gives "DOMException: key.algorithm does not match that of operation" #269

Answered by panva
gitowiec asked this question in Q&A
Discussion options

You must be logged in to vote

How I can correct the problem of key algorithm not matching to the operation?

Use RSASSA-PKCS1-v1_5 for RS256, RS384, and RS512, or use RSA-PSS for PS256, PS384, and PS512. You cannot mix and match.

In your code above just changing RS256 to PS256 should do the trick.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by gitowiec
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants