I received working application built in ruby on rails and react.js and i have problem with running server on ruby. That's what have I done:
- ruby 3.1.2,
- rails 5.1.2,
- gem 3.3.7,
- with blunder I installed all dependecies,
- I also changed config in database.yml.
Whatever I do I only see this errors:
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/devise-jwt-0.8.1/lib/devise/jwt.rb:29:in `<module:Devise>' [dry-configurable] default value as positional argument to settings is deprecated and will be removed in the next major version
Provide a `default:` keyword argument instead
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/devise-jwt-0.8.1/lib/devise/jwt.rb:29:in `<module:Devise>' [dry-configurable] passing a constructor as a block is deprecated and will be removed in the next major version
Provide a `constructor:` keyword argument instead
rake aborted!
ArgumentError: wrong number of arguments (given 3, expected 2)
C:/Users/Wojciech Kowalczyk/Desktop/java_script/zadanie_rekrutacyjne/testowe 2/backend/config/environment.rb:5:in `<top (required)>'
That's how the jwt.rb file looks like:
require 'forwardable'
require 'devise'
require 'active_support/core_ext/module/attribute_accessors'
require 'warden/jwt_auth'
require 'devise/jwt/version'
require 'devise/jwt/mapping_inspector'
require 'devise/jwt/defaults_generator'
require 'devise/jwt/railtie'
require 'devise/jwt/models'
require 'devise/jwt/revocation_strategies'
require 'dry-configurable'
# Authentication library
module Devise
# Yields to Warden::JWTAuth.config
#
# @see Warden::JWTAuth
def self.jwt
Warden::JWTAuth.config.to_h
yield(Devise::JWT.config)
Devise::JWT.config.to_h
end
add_module(:jwt_authenticatable, strategy: :jwt)
# JWT extension for devise
module JWT
extend Dry::Configurable
def self.forward_to_warden(setting, value)
default = Warden::JWTAuth.config.send(setting)
Warden::JWTAuth.config.send("#{setting}=", value || default)
Warden::JWTAuth.config.send(setting)
end
setting(:secret, Warden::JWTAuth.config.secret) do |value|
forward_to_warden(:secret, value)
end
setting(:expiration_time, Warden::JWTAuth.config.expiration_time) do |value|
forward_to_warden(:expiration_time, value)
end
setting(:dispatch_requests,
Warden::JWTAuth.config.dispatch_requests) do |value|
forward_to_warden(:dispatch_requests, value)
end
setting(:revocation_requests,
Warden::JWTAuth.config.revocation_requests) do |value|
forward_to_warden(:revocation_requests, value)
end
setting(:aud_header, Warden::JWTAuth.config.aud_header) do |value|
forward_to_warden(:aud_header, value)
end
# A hash of warden scopes as keys and an array of request formats that will
# be processed as values. When a scope is not present or if it has a nil
# item, requests without format will be taken into account.
#
# For example, with following configuration, `user` scope would dispatch and
# revoke tokens in `json` requests, while `admin_user` would do it in `xml`
# and with no format.
#
# @example
# {
# user: [:json],
# admin_user: [nil, :xml]
# }
setting :request_formats, {}
end
end