Skip to content

key is of invalid type #306

Answered by oxisto
PavelXWX asked this question in Q&A
Discussion options

You must be logged in to vote

You are using an asymetric signing method (ES256, which is based on ECDSA), but you are supplying a symmetric key ([]byte). You either need to use a symmetric signing method, such as HMAC or provide a *ecdsa.PrivateKey for ES256.

You can find more about this in our new project page (which is still under construction): https://golang-jwt.github.io/jwt/usage/create/ and https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by oxisto
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
Converted from issue

This discussion was converted from issue #305 on April 11, 2023 09:04.