joken-elixir / joken

Elixir JWT library
Apache License 2.0
772 stars 102 forks source link

Couldn't recognize the signer algorithm RS256 #288

Closed ghost closed 4 years ago

ghost commented 4 years ago

{:joken, "~> 2.0"} In a .iex.exs file I'm calling signer = Joken.Signer.create("RS256", "secret") and getting:

** (Joken.Error) Couldn't recognize the signer algorithm.

Possible values are:

["HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "ES256", "ES384", "ES512", "PS256", "PS384", "PS512", "Ed25519", "Ed25519ph", "Ed448", "Ed448ph"]

    (joken 2.2.0) lib/joken/signer.ex:93: Joken.Signer.create/3

RS256 appears in the list of possible values.

victorolinasc commented 4 years ago

Hi @kvsteger-driver !

This is expected (and the message is not very clear...). RS256 needs an RSA key. "secret" is a symmetric key and not an asymmetric key. It is only possible to use with HS*** algorithms currently.

Take a look at the guides about this: