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
The base.rb file define a session method that use the scope of the app
On the other hand, jwt.rb redefines this method in case of a JSON request (with Content-Type: application/json header). Maybe this method should call super in case it's a JSON request but their no JWT token? I tried that locally and it's working.
I'm not sure why the JWT plugin returns an empty hash instead of using super?
The text was updated successfully, but these errors were encountered:
If you only want to use the JSON API support if you have a JWT submitted, you could try this in your rodauth config:
use_jwt? do
jwt_token
end
If you do this, when you want to use the JSON API, you'll have to submit a bogus Authorization header when first creating the session (e.g. when logging in). Otherwise, Rodauth will not operate in JSON API mode, it will use the normal session (generally stored in a encrypted cookie) instead of a JWT session.
Can you try the above and see if it fixes your issue?
Note that Rodauth does not support mixing the JSON API with normal HTML form use in the same session. There is nothing in Rodauth that will convert the normal session into a JWT session or vice-versa. I don't think that's an issue in your code, just something to be aware of.
Following this issue (janko/rodauth-rails#8), I discovered an issue when doing AJAX call when using the JWT plugin.
Thanks to @janko, I was able to reproduce the issue:
The
base.rb
file define asession
method that use thescope
of the appOn the other hand,
jwt.rb
redefines this method in case of a JSON request (withContent-Type: application/json
header). Maybe this method should callsuper
in case it's a JSON request but their no JWT token? I tried that locally and it's working.I'm not sure why the JWT plugin returns an empty hash instead of using
super
?The text was updated successfully, but these errors were encountered: