liquid_feedback_frontend
changeset 1515:6077545667ec
Return remaining life time of tokens
author | bsw |
---|---|
date | Thu Aug 20 14:01:38 2020 +0200 (2020-08-20) |
parents | 3fcae27c2709 |
children | 9d99a4f262a2 |
files | app/main/oauth2/validate.lua |
line diff
1.1 --- a/app/main/oauth2/validate.lua Thu Aug 20 14:01:15 2020 +0200 1.2 +++ b/app/main/oauth2/validate.lua Thu Aug 20 14:01:38 2020 +0200 1.3 @@ -45,6 +45,10 @@ 1.4 1.5 local r = json.object() 1.6 r.scope = scope 1.7 + 1.8 +local expiry = db:query({ "SELECT FLOOR(EXTRACT(EPOCH FROM ? - now())) AS access_time_left", token.expiry }, "object") 1.9 +r.expires_in = expiry.access_time_left 1.10 + 1.11 r.member_id = token.member_id 1.12 if token.member.role then 1.13 r.member_is_role = true