ставит ENV ['DEVISE_JWT_SECRET_KEY'] возвращает секретный ключ в производственной консоли.
DEVISE_JWT_SECRET_KEY устанавливается с помощью команды экспорта в ОС Centos.
devise.rb file
config.jwt do |jwt|
jwt.secret = ENV['DEVISE_JWT_SECRET_KEY']
jwt.dispatch_requests = [
['POST', %r{^/users/sign_in.json$}]
]
jwt.revocation_requests = [
['DELETE', %r{^/logout$}]
]
jwt.expiration_time = 1.day.to_i
end
Получение этой ошибки по запросу входа в систему.
==> log/production.log <==
I, [2020-03-29T11:15:05.149855 #18692] INFO -- : [9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c] Started POST "/users/sign_in.json" for 110.93.200.118 at 2020-03-29 11:15:05 +0000
I, [2020-03-29T11:15:05.150525 #18692] INFO -- : [9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c] Processing by Devise::SessionsController#create as JSON
I, [2020-03-29T11:15:05.150604 #18692] INFO -- : [9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c] Parameters: {"user"=>{"email"=>"test@example.com", "password"=>"[FILTERED]"}, "session"=>{"user"=>{"email"=>"test@example.com", "password"=>"[FILTERED]"}}}
D, [2020-03-29T11:15:05.152091 #18692] DEBUG -- : [9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c] User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."email" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["email", "test@example.com"], ["LIMIT", 1]]
D, [2020-03-29T11:15:05.325258 #18692] DEBUG -- : [9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c] Clinic Load (1.4ms) SELECT "clinics".* FROM "clinics" WHERE "clinics"."id" = $1 LIMIT $2 [["id", 3], ["LIMIT", 1]]
I, [2020-03-29T11:15:05.326744 #18692] INFO -- : [9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c] Completed 500 Internal Server Error in 176ms (ActiveRecord: 1.7ms)
F, [2020-03-29T11:15:05.327800 #18692] FATAL -- : [9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c]
F, [2020-03-29T11:15:05.328843 #18692] FATAL -- : [9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c] TypeError (no implicit conversion of nil into String):
F, [2020-03-29T11:15:05.329247 #18692] FATAL -- : [9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c]
F, [2020-03-29T11:15:05.329333 #18692] FATAL -- : [9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c] jwt (2.2.1) lib/jwt/algos/hmac.rb:14:in `digest'
[9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c] jwt (2.2.1) lib/jwt/algos/hmac.rb:14:in `sign'
[9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c] jwt (2.2.1) lib/jwt/signature.rb:37:in `sign'
[9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c] jwt (2.2.1) lib/jwt/encode.rb:57:in `encode_signature'
[9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c] jwt (2.2.1) lib/jwt/encode.rb:34:in `encoded_signature'
[9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c] jwt (2.2.1) lib/jwt/encode.rb:20:in `segments'
[9f71ec3f-d4ac-4efa-9ba1-09276c1e5f1c] jwt (2.2.1) lib/jwt.rb:24:in `encode'