fix undefined references to JWT_SECRET
This commit is contained in:
parent
b92f6688c7
commit
66c2c3b6a2
4
app.rb
4
app.rb
@ -384,7 +384,7 @@ get "/token" do
|
|||||||
exp = Time.now.to_i + SECONDS_PER_MINUTE * 2
|
exp = Time.now.to_i + SECONDS_PER_MINUTE * 2
|
||||||
payload = {name: "anonymous", exp: exp, jti: Random.uuid}
|
payload = {name: "anonymous", exp: exp, jti: Random.uuid}
|
||||||
expires_at = Time.at(exp).to_datetime
|
expires_at = Time.at(exp).to_datetime
|
||||||
token = JWT.encode payload, JWT_SECRET, "HS256"
|
token = JWT.encode payload, config.jwt_secret.unwrap, "HS256"
|
||||||
x = {token: token, expires_at: expires_at}
|
x = {token: token, expires_at: expires_at}
|
||||||
|
|
||||||
jsonify x
|
jsonify x
|
||||||
@ -392,7 +392,7 @@ end
|
|||||||
|
|
||||||
get "/token/validate" do
|
get "/token/validate" do
|
||||||
token = req_headers["authorization"].split[1]
|
token = req_headers["authorization"].split[1]
|
||||||
payload = JWT.decode token, JWT_SECRET, true, algorithm: "HS256"
|
payload = JWT.decode token, config.jwt_secret.unwrap, true, algorithm: "HS256"
|
||||||
|
|
||||||
jsonify payload
|
jsonify payload
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user