nsarno / knock

Seamless JWT authentication for Rails API
MIT License
2.07k stars 253 forks source link

Rails 5.2 heroku Jwt Knock issue #262

Closed dcalixto closed 4 years ago

dcalixto commented 4 years ago

After setup knock and check it on development everything went well, so i pushed the repo to heroku and for login the knock generate the token and login fine, but when go a authorized section like profile in the logs shows:

2020-05-27T04:20:22.662100+00:00 app[web.1]: I, [2020-05-27T04:20:22.660299 #4]  INFO -- : [4099a96f-91b7-4a5d-948f-50f958d86850] Filter chain halted as :authenticate_user rendered or redirected
2020-05-27T04:20:22.662101+00:00 app[web.1]: I, [2020-05-27T04:20:22.660477 #4]  INFO -- : [4099a96f-91b7-4a5d-948f-50f958d86850] Completed 401 Unauthorized in 1ms (ActiveRecord: 0.0ms)

Everybody says that is rails 5.2 credentials issue, that must place

config.token_secret_signature_key = -> { Rails.application.credentials.secret_key_base }

on config, ok done

and than place skip_before_action :verify_authenticity_token on UserTokenController < Knock::AuthTokenController

on controller,ok done

after this still not working.

please someone has any idea why this on production?