LoginSignup
2
1

More than 5 years have passed since last update.

Rails5とknockでAuth0のJWTトークンを検証しようとしたが401になる

Posted at

おそらくAuth0の管理画面上のclient_secretがbase64_encodeされていたものがされなくなったのが原因だったのだが、knockでエラーメッセージが何も出なくて、binding.pryしながらソース読んだりわりと大変だったのでメモ

binding.pryしてknockを実行していくと、JWTのでコードのところで以下のようになる。

JWT::VerificationError: Signature verification raised
from /bundle/gems/jwt-1.5.6/lib/jwt.rb:156:in `verify_signature_algo'
config/initializers/knock.rb
...

config.token_secret_signature_key = -> { JWT.base64url_encode(JWT.base64url_decode Rails.application.secrets.auth0_client_secret) }

...

こんな感じにしたら動いた

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1