/token should provide JSON
This commit is contained in:
parent
66c2c3b6a2
commit
3c2e0cdcb8
3
app.rb
3
app.rb
@ -380,14 +380,13 @@ get "/pid", provides: "json" do
|
|||||||
jsonify({ppid: ppid, pid: Process.pid}, pretty:)
|
jsonify({ppid: ppid, pid: Process.pid}, pretty:)
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/token" do
|
get "/token", provides: "json" 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, config.jwt_secret.unwrap, "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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/token/validate" do
|
get "/token/validate" do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user