ruby: config request JWT used in functions

This commit is contained in:
rivexe
2023-02-06 16:14:53 +03:00
parent 5f7f8d66d5
commit 7a50b8fda2
3 changed files with 5 additions and 5 deletions

View File

@ -59,7 +59,7 @@ class ServiceConverter
req.add_field("Accept", "application/json") # set headers
req.add_field("Content-Type", "application/json")
if JwtHelper.is_enabled # if the signature is enabled
if JwtHelper.is_enabled && JwtHelper.use_for_request # if the signature is enabled
payload["token"] = JwtHelper.encode(payload) # get token and save it to the payload
jwtHeader = Rails.configuration.header.empty? ? "Authorization" : Rails.configuration.header; # get signature authorization header
req.add_field(jwtHeader, "Bearer #{JwtHelper.encode({ :payload => payload })}") # set it to the request with the Bearer prefix