-
Notifications
You must be signed in to change notification settings - Fork 252
Filter chain halted as :authenticate_user rendered or redirected Completed 401 Unauthorized #146
Comments
@jessecravens I have a Rails API that just ran into this problem, and it was for two reasons:
The second thing I did was throw the error inside
I found out the error was:
And by adding the While there could be a dozen different problems you could run into, I hope this helps you track it down. (I opened an issue previously about not swallowing the error here #122) |
Thanks @johnmosesman overriding the method:
which leads me to this issue with knock . ruby-jwt : jwt/ruby-jwt#115 . |
I got this working, as I expected I was passing in the token_public_key incorrectly. #148 |
I'm opening this separate from #139 , same result, perhaps different reasons ... hopefully just my ignorance.
I'm not seeing how to get passed decoding the JWT from Auth0 ... so a User can be generated by
before_action :authenticate_user
on the controller andself.from_token_payload
on the model. I'm seeing that Auth0 always uses RS256 algorithm (and recommends it as secure, while HS256 is not), so I changed it in the knock.rb configconfig.token_signature_algorithm = 'RS256'
and added theconfig.token_public_key
as well.Stepping through I see the algorithms match:
Along with the algorithm (algo) , I've also verified the presence of the jwt(signing_input), key, and signature.
My JWT validates and signature verifies at jwt.io but when I step through the decoding it always falls right into:
Continuing to result in 'Filter chain halted as :authenticate_user rendered or redirected Completed 401 Unauthorized'
The text was updated successfully, but these errors were encountered: