You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.
Hi, I've been trying to configure a Rails API 5.2 app with Knock (using Auth0) following the instructions and I got to a point that I was just getting a:
Filter chain halted as :authenticate_user rendered or redirected
Unfortunately there's no logging associated to any of the gems involved in this process so I had to dig in and try to investigate what was exactly happening. After some investigation I've found the actual error was:
More digging into why I was getting this error and I've found that the configuration for auth0 suggests to set the following in config/initializers/knock.rb:
# If using Auth0, uncomment the line belowconfig.token_audience=->{Rails.application.credentials.auth0_client_id}
where the auth0_client_id is client_id associated with the client secret.
The sample SPA I've downloaded from the Auth0 tutorials (which has a /private link that performs an authenticated call to the API) has a different configuration for the audience:
So the aud configured in the server didn't match any of audience contained in payload aud causing the verification to fail and consequently the authentication as well.
Any thoughts on this? Am I missing something here?
After having the audiences matching, I now have the following error happening:
46: self.class.send(:define_method,getter_name)do47: unlessinstance_variable_defined?(memoization_var_name)48: current=49: begin50: Knock::AuthToken.new(token: token).entity_for(entity_class)51: rescue52: binding.pry=>53: nil54: end[1]pry(#<SecuredController>)> $!=>#<ActiveRecord::RecordNotFound: Couldn't find User with 'id'=auth0|<USER_ID>>
Is this expected? Is the user expected to already exist in my database and using as id the auth0 one? I was expecting this process to be the one to create the user itself.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi, I've been trying to configure a Rails API 5.2 app with Knock (using Auth0) following the instructions and I got to a point that I was just getting a:
Filter chain halted as :authenticate_user rendered or redirected
Unfortunately there's no logging associated to any of the gems involved in this process so I had to dig in and try to investigate what was exactly happening. After some investigation I've found the actual error was:
More digging into why I was getting this error and I've found that the configuration for auth0 suggests to set the following in
config/initializers/knock.rb
:where the
auth0_client_id
is client_id associated with the client secret.The sample SPA I've downloaded from the Auth0 tutorials (which has a
/private
link that performs an authenticated call to the API) has a different configuration for the audience:So when I was making that
/private
authenticated call from the SPA to the Rails API I was getting the followingpayload
in the token:but the server settings had the following:
So the
aud
configured in the server didn't match any of audience contained in payloadaud
causing the verification to fail and consequently the authentication as well.Any thoughts on this? Am I missing something here?
After having the audiences matching, I now have the following error happening:
Is this expected? Is the user expected to already exist in my database and using as
id
the auth0 one? I was expecting this process to be the one to create the user itself.The text was updated successfully, but these errors were encountered: