/token should provide pretty-printing
This commit is contained in:
parent
3c2e0cdcb8
commit
2d1c9f7418
3
app.rb
3
app.rb
@ -381,12 +381,15 @@ get "/pid", provides: "json" do
|
||||
end
|
||||
|
||||
get "/token", provides: "json" do
|
||||
pretty = params.key? :pretty
|
||||
|
||||
exp = Time.now.to_i + SECONDS_PER_MINUTE * 2
|
||||
payload = {name: "anonymous", exp: exp, jti: Random.uuid}
|
||||
expires_at = Time.at(exp).to_datetime
|
||||
token = JWT.encode payload, config.jwt_secret.unwrap, "HS256"
|
||||
x = {token: token, expires_at: expires_at}
|
||||
|
||||
jsonify x, pretty:
|
||||
end
|
||||
|
||||
get "/token/validate" do
|
||||
|
Loading…
x
Reference in New Issue
Block a user